LinkHeaderValueExtensions Class
Provides extension methods for working with Link header values.
public static class LinkHeaderValueExtensionsMethods
| Name | Description |
|---|---|
| EnumerateLinkHeaders(HttpHeaders) | Enumerates all Link header values from HTTP headers. |
| GetLink(IEnumerable<LinkHeaderValue>, string) | Gets the first link declaring the specified relation type. |
| GetLinkUrl(IEnumerable<LinkHeaderValue>, string) | Gets the URL of the first link with the specified relation type. |
EnumerateLinkHeaders(HttpHeaders)
LinkHeaderValueExtensions.csEnumerates all Link header values from HTTP headers.
public static IEnumerable<LinkHeaderValue> EnumerateLinkHeaders(this HttpHeaders headers)Parameters
headersHttpHeaders- The HTTP headers to parse.
Returns
IEnumerable<LinkHeaderValue> A collection of LinkHeaderValue instances.
GetLink(IEnumerable<LinkHeaderValue>, string)
LinkHeaderValueExtensions.csGets the first link declaring the specified relation type.
public static LinkHeaderValue? GetLink(this IEnumerable<LinkHeaderValue> links, string rel)Parameters
linksIEnumerable<LinkHeaderValue>- The collection of links to search.
relstring- The relation type to find. A link matches when
LinkHeaderValue.Relcontains this relation type, which may be one of several space-separated values.
Returns
LinkHeaderValue? The first LinkHeaderValue with the specified relation type, or null if not found.
GetLinkUrl(IEnumerable<LinkHeaderValue>, string)
LinkHeaderValueExtensions.csGets the URL of the first link with the specified relation type.
public static string? GetLinkUrl(this IEnumerable<LinkHeaderValue> links, string rel)Parameters
linksIEnumerable<LinkHeaderValue>- The collection of links to search.
relstring- The relation type to find.
Returns
string? The URL of the first link with the specified relation type, or null if not found.