Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​Net.​Http.​Headers.​HeaderUtilities
Assembly: Microsoft.Net.Http.Headers
Inheritance: object → HeaderUtilities
Provides utilities to parse and modify HTTP header values.
Methods
public static
bool
TryParseSeconds​(Extensions.​Primitives.​StringValues headerValues,
string targetValue,
System.​Nullable`1& value)
public static
bool
ContainsCacheDirective​(Extensions.​Primitives.​StringValues cacheControlDirectives,
string targetDirectives)
Check if a target directive exists among the set of given cache control directives.
Returns <see langword="true" /> if <paramref name="targetDirectives" /> is contained in <paramref name="cacheControlDirectives" /> ;
otherwise, <see langword="false" /> .
cacheControlDirectives
The <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> containing the set of cache control directives.
targetDirectives
The target cache control directives to look for.
public static
bool
TryParseNonNegativeInt32​(Extensions.​Primitives.​StringSegment value,
System.​Int32& result)
public static
bool
TryParseNonNegativeInt64​(Extensions.​Primitives.​StringSegment value,
System.​Int64& result)
public static
string
FormatNonNegativeInt64​(long value)
Converts the non-negative 64-bit numeric value to its equivalent string representation.
Returns The string representation of the value of this instance, consisting of a sequence of digits ranging from 0 to 9 with no leading zeroes.
value
The number to convert.
public static
bool
TryParseDate​(Extensions.​Primitives.​StringSegment input,
System.​DateTimeOffset& result)
public static
string
FormatDate​(System.​DateTimeOffset dateTime)
Formats the <paramref name="dateTime" /> using the RFC1123 format specifier.
Returns The formatted date.
dateTime
The date to format.
public static
string
FormatDate​(System.​DateTimeOffset dateTime,
bool quoted)
Formats the <paramref name="dateTime" /> using the RFC1123 format specifier and optionally quotes it.
Returns The formatted date.
dateTime
The date to format.
quoted
Determines if the formatted date should be quoted.
RemoveQuotes​(Extensions.​Primitives.​StringSegment input)
Removes quotes from the specified <paramref name="input" /> if quoted.
Returns The value without quotes.
input
The input to remove quotes from.
public static
bool
IsQuoted​(Extensions.​Primitives.​StringSegment input)
Determines if the specified <paramref name="input" /> is quoted.
Returns <see langword="true" /> if the value is quoted, otherwise <see langword="false" /> .
input
The value to inspect.
UnescapeAsQuotedString​(Extensions.​Primitives.​StringSegment input)
Given a quoted-string as defined by <see href="https://tools.ietf.org/html/rfc7230#section-3.2.6">the RFC specification</see> ,
removes quotes and unescapes backslashes and quotes. This assumes that the input is a valid quoted-string.
Returns An unescaped version of the quoted-string.
input
The quoted-string to be unescaped.
EscapeAsQuotedString​(Extensions.​Primitives.​StringSegment input)
Escapes a <see cref="T:Microsoft.Extensions.Primitives.StringSegment" /> as a quoted-string, which is defined by
<see href="https://tools.ietf.org/html/rfc7230#section-3.2.6">the RFC specification</see> .
Returns An escaped version of the quoted-string.
input
The input to be escaped.
Remarks
This will add a backslash before each backslash and quote and add quotes
around the input. Assumes that the input does not have quotes around it,
as this method will add them. Throws if the input contains any invalid escape characters,
as defined by rfc7230.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object