LinkHeaderValue Class

Represents a Link header value as defined in RFC 8288.

public sealed class LinkHeaderValue

Properties

NameDescription
ParametersGets the list of parameters associated with the link.
RelGets the relation type (rel parameter) of the link.
UrlGets the URL of the link.

Gets the list of parameters associated with the link.

public IReadOnlyList<KeyValuePair<string, string>> Parameters { get; }

Gets the relation type (rel parameter) of the link.

public string Rel { get; }

Property value

string

Gets the URL of the link.

public string Url { get; }

Property value

string

Methods

NameDescription
GetParameterValue(string)Gets the value of a parameter by name. The comparison is case-insensitive.
Parse(HttpHeaders)Parses Link header values from HTTP headers.
Parse(HttpResponseMessage)Parses Link header values from an HTTP response message.
Parse(ReadOnlySpan<char>)Parses a Link header value from a character span.
Parse(string)Parses a Link header value from a string.

GetParameterValue(string)

LinkHeaderValue.cs

Gets the value of a parameter by name. The comparison is case-insensitive.

public string? GetParameterValue(string parameterName)

Parameters

parameterName string
The name of the parameter.

Returns

string? The parameter value, or null if the parameter is not found.

Parse overloads

Parse(HttpHeaders)

LinkHeaderValue.cs

Parses Link header values from HTTP headers.

public static IEnumerable<LinkHeaderValue> Parse(HttpHeaders headers)
Parameters
headers HttpHeaders
The HTTP headers containing Link header values.
Returns

IEnumerable<LinkHeaderValue> A collection of LinkHeaderValue instances.

Parse(HttpResponseMessage)

LinkHeaderValue.cs

Parses Link header values from an HTTP response message.

public static IEnumerable<LinkHeaderValue> Parse(HttpResponseMessage httpResponse)
Parameters
httpResponse HttpResponseMessage
The HTTP response message containing Link headers.
Returns

IEnumerable<LinkHeaderValue> A collection of LinkHeaderValue instances.

Parse(ReadOnlySpan<char>)

LinkHeaderValue.cs

Parses a Link header value from a character span.

public static IEnumerable<LinkHeaderValue> Parse(ReadOnlySpan<char> value)
Parameters
value ReadOnlySpan<char>
The Link header value to parse.
Returns

IEnumerable<LinkHeaderValue> A collection of LinkHeaderValue instances.

Parse(string)

LinkHeaderValue.cs

Parses a Link header value from a string.

public static IEnumerable<LinkHeaderValue> Parse(string value)
Parameters
value string
The Link header value to parse.
Returns

IEnumerable<LinkHeaderValue> A collection of LinkHeaderValue instances.