Compartilhar via


HttpHeadersExtensions.GetFirstOrDefault<TType> Method

Definition

Gets the first HTTP header or default value.

public static TType GetFirstOrDefault<TType> (this System.Net.Http.Headers.HttpHeaders headers, string name, Func<string,TType> transform, TType defaultValue = default);
static member GetFirstOrDefault : System.Net.Http.Headers.HttpHeaders * string * Func<string, 'ype> * 'ype -> 'ype
<Extension()>
Public Function GetFirstOrDefault(Of TType) (headers As HttpHeaders, name As String, transform As Func(Of String, TType), Optional defaultValue As TType = Nothing) As TType

Type Parameters

TType

The type of the object housed in the header.

Parameters

headers
HttpHeaders

The HTTP headers.

name
String

The header name.

transform
Func<String,TType>

A transformation function that converts strings to TType.

defaultValue
TType

The default value.

Returns

TType

Applies to