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.​MediaTypeHeaderValue

Assembly: Microsoft.Net.Http.Headers

Inheritance: object → MediaTypeHeaderValue

Representation of the media type header. See <see href="https://tools.ietf.org/html/rfc6838" /> .

Properties

Gets or sets the value of the charset parameter. Returns <see cref="F:Microsoft.Extensions.Primitives.StringSegment.Empty" /> if there is no charset.
Encoding
Gets or sets the value of the Encoding parameter. Setting the Encoding will set the <see cref="P:Microsoft.Net.Http.Headers.MediaTypeHeaderValue.Charset" /> to <see cref="P:System.Text.Encoding.WebName" /> .
Gets or sets the value of the boundary parameter. Returns <see cref="F:Microsoft.Extensions.Primitives.StringSegment.Empty" /> if there is no boundary.
Gets or sets the media type's parameters. Returns an empty <see cref="T:System.Collections.Generic.IList`1" /> if there are no parameters.
public double?
Quality
Gets or sets the value of the quality parameter. Returns null if there is no quality.
Gets or sets the value of the media type. Returns <see cref="F:Microsoft.Extensions.Primitives.StringSegment.Empty" /> if there is no media type.
Gets the type of the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> .
Remarks See <see href="https://tools.ietf.org/html/rfc6838#section-4.2" /> for more details on the type.
Gets the subtype of the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> .
Remarks See <see href="https://tools.ietf.org/html/rfc6838#section-4.2" /> for more details on the subtype.
SubTypeWithoutSuffix
Gets subtype of the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> , excluding any structured syntax suffix. Returns <see cref="F:Microsoft.Extensions.Primitives.StringSegment.Empty" /> if there is no subtype without suffix.
Gets the structured syntax suffix of the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> if it has one. See <see href="https://tools.ietf.org/html/rfc6838#section-4.8">The RFC documentation on structured syntaxes.</see>
Get a <see cref="T:System.Collections.Generic.IList`1" /> of facets of the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> . Facets are a period separated list of StringSegments in the <see cref="P:Microsoft.Net.Http.Headers.MediaTypeHeaderValue.SubTypeWithoutSuffix" /> . See <see href="https://tools.ietf.org/html/rfc6838#section-3">The RFC documentation on facets.</see>
public bool
MatchesAllTypes
Gets whether this <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> matches all types.
public bool
MatchesAllSubTypes
Gets whether this <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> matches all subtypes.
public bool
MatchesAllSubTypesWithoutSuffix
Gets whether this <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> matches all subtypes, ignoring any structured syntax suffix.
public bool
IsReadOnly
Gets whether the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> is readonly.

Methods

public bool
IsSubsetOf​(MediaTypeHeaderValue otherMediaType)
Gets a value indicating whether this <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> is a subset of <paramref name="otherMediaType" /> . A "subset" is defined as the same or a more specific media type according to the precedence described in <see href="https://www.ietf.org/rfc/rfc2068.txt" /> section 14.1, Accept.
Returns A value indicating whether this <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> is a subset of <paramref name="otherMediaType" /> .
otherMediaType The <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> to compare.
Remarks For example "multipart/mixed; boundary=1234" is a subset of "multipart/mixed; boundary=1234", "multipart/mixed", "multipart/*", and "*/*" but not "multipart/mixed; boundary=2345" or "multipart/message; boundary=1234".
Copy​()
Performs a deep copy of this object and all of it's NameValueHeaderValue sub components, while avoiding the cost of re-validating the components.
Returns A deep copy.
CopyAsReadOnly​()
Performs a deep copy of this object and all of it's NameValueHeaderValue sub components, while avoiding the cost of re-validating the components. This copy is read-only.
Returns A deep, read-only, copy.
public bool
MatchesMediaType​(Extensions.​Primitives.​StringSegment otherMediaType)
Gets a value indicating whether <paramref name="otherMediaType" /> is a subset of this <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> in terms of type/subType. A "subset" is defined as the same or a more specific media type according to the precedence described in <see href="https://www.ietf.org/rfc/rfc2068.txt" /> section 14.1, Accept.
Returns A value indicating whether <paramref name="otherMediaType" /> is a subset of this <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> .
otherMediaType The <see cref="T:Microsoft.Extensions.Primitives.StringSegment" /> to compare.
Remarks For example "multipart/mixed" is a subset of "multipart/mixed", "multipart/*", and "*/*" but not "multipart/message."
public string
ToString​()
public bool
Equals​(object obj)
public int
GetHashCode​()
public static MediaTypeHeaderValue
Parse​(Extensions.​Primitives.​StringSegment input)
Takes a media type and parses it into the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> and its associated parameters.
Returns The parsed <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> .
input The <see cref="T:Microsoft.Extensions.Primitives.StringSegment" /> with the media type.
public static bool
TryParse​(Extensions.​Primitives.​StringSegment input, MediaTypeHeaderValue& parsedValue)
ParseList​(System.​Collections.​Generic.​IList?<​string> inputs)
Takes an <see cref="T:System.Collections.Generic.IList`1" /> of <see cref="T:System.String" /> and parses it into the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue"></see> and its associated parameters.
Returns The parsed <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> .
inputs A list of media types
ParseStrictList​(System.​Collections.​Generic.​IList?<​string> inputs)
Takes an <see cref="T:System.Collections.Generic.IList`1" /> of <see cref="T:System.String" /> and parses it into the <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue"></see> and its associated parameters. Throws if there is invalid data in a string.
Returns The parsed <see cref="T:Microsoft.Net.Http.Headers.MediaTypeHeaderValue" /> .
inputs A list of media types
public static bool
TryParseList​(System.​Collections.​Generic.​IList?<​string> inputs, System.​Collections.​Generic.​IList`1&? parsedValues)
public static bool
TryParseStrictList​(System.​Collections.​Generic.​IList?<​string> inputs, System.​Collections.​Generic.​IList`1&? parsedValues)
protected void
Finalize​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object