MediaTypeHeaderValue Class

Definition

Representation of the media type header. See https://tools.ietf.org/html/rfc6838.

public ref class MediaTypeHeaderValue
public class MediaTypeHeaderValue
type MediaTypeHeaderValue = class
Public Class MediaTypeHeaderValue
Inheritance
MediaTypeHeaderValue

Constructors

MediaTypeHeaderValue(String)
MediaTypeHeaderValue(String, Double)
MediaTypeHeaderValue(StringSegment)

Initializes a MediaTypeHeaderValue instance.

MediaTypeHeaderValue(StringSegment, Double)

Initializes a MediaTypeHeaderValue instance.

Properties

Boundary

Gets or sets the value of the boundary parameter. Returns Empty if there is no boundary.

Charset

Gets or sets the value of the charset parameter. Returns Empty if there is no charset.

Encoding

Gets or sets the value of the Encoding parameter. Setting the Encoding will set the Charset to WebName.

Facets

Get a IList<T> of facets of the MediaTypeHeaderValue. Facets are a period separated list of StringSegments in the SubTypeWithoutSuffix. See The RFC documentation on facets.

IsReadOnly

Gets whether the MediaTypeHeaderValue is readonly.

MatchesAllSubTypes

Gets whether this MediaTypeHeaderValue matches all subtypes.

MatchesAllSubTypesWithoutSuffix

Gets whether this MediaTypeHeaderValue matches all subtypes, ignoring any structured syntax suffix.

MatchesAllTypes

Gets whether this MediaTypeHeaderValue matches all types.

MediaType

Gets or sets the value of the media type. Returns Empty if there is no media type.

Parameters

Gets or sets the media type's parameters. Returns an empty IList<T> if there are no parameters.

Quality

Gets or sets the value of the quality parameter. Returns null if there is no quality.

SubType

Gets the subtype of the MediaTypeHeaderValue.

SubTypeWithoutSuffix

Gets subtype of the MediaTypeHeaderValue, excluding any structured syntax suffix. Returns Empty if there is no subtype without suffix.

Suffix

Gets the structured syntax suffix of the MediaTypeHeaderValue if it has one. See The RFC documentation on structured syntaxes.

Type

Gets the type of the MediaTypeHeaderValue.

Methods

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.

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.

Equals(Object)

Determines whether the specified object is equal to the current object.

GetHashCode()

Serves as the default hash function.

IsSubsetOf(MediaTypeHeaderValue)

Gets a value indicating whether this MediaTypeHeaderValue is a subset of otherMediaType. A "subset" is defined as the same or a more specific media type according to the precedence described in https://www.ietf.org/rfc/rfc2068.txt section 14.1, Accept.

MatchesMediaType(StringSegment)

Gets a value indicating whether otherMediaType is a subset of this 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 https://www.ietf.org/rfc/rfc2068.txt section 14.1, Accept.

Parse(String)
Parse(StringSegment)

Takes a media type and parses it into the MediaTypeHeaderValue and its associated parameters.

ParseList(IList<String>)

Takes an IList<T> of String and parses it into the MediaTypeHeaderValue and its associated parameters.

ParseStrictList(IList<String>)

Takes an IList<T> of String and parses it into the MediaTypeHeaderValue and its associated parameters. Throws if there is invalid data in a string.

ToString()

Returns a string that represents the current object.

TryParse(String, MediaTypeHeaderValue)
TryParse(StringSegment, MediaTypeHeaderValue)

Takes a media type, which can include parameters, and parses it into the MediaTypeHeaderValue and its associated parameters.

TryParseList(IList<String>, IList<MediaTypeHeaderValue>)

Takes an IList<T> of String and parses it into the MediaTypeHeaderValue and its associated parameters.

TryParseStrictList(IList<String>, IList<MediaTypeHeaderValue>)

Takes an IList<T> of String and parses it into the MediaTypeHeaderValue and its associated parameters.

Applies to