HttpMediaTypeHeaderValue HttpMediaTypeHeaderValue HttpMediaTypeHeaderValue HttpMediaTypeHeaderValue Class

Represents the value of the Content-Type HTTP header on the HTTP content in a request or a response.

Syntax

Declaration

public sealed class HttpMediaTypeHeaderValuepublic sealed class HttpMediaTypeHeaderValuePublic NotInheritable Class HttpMediaTypeHeaderValuepublic sealed class HttpMediaTypeHeaderValue

Remarks

The HttpMediaTypeHeaderValue class represents the value of the Content-Type HTTP header on HTTP content sent in an HTTP request or received in an HTTP response.

The ContentType property on the HttpContentHeaderCollection returns an HttpMediaTypeHeaderValue object.

Constructors summary

Initializes a new instance of the HttpMediaTypeHeaderValue class.

Properties summary

Gets or sets the character set of the entity-body used in the Content-Type HTTP header.

Gets or sets the media-type of the entity-body used in the Content-Type HTTP header.

Gets a set of parameters included in the Content-Type HTTP header.

Methods summary

Converts a string to an HttpMediaTypeHeaderValue instance.

Returns a string that represents the current HttpMediaTypeHeaderValue object.

Determines whether a string is valid HttpMediaTypeHeaderValue information.

Constructors

  • HttpMediaTypeHeaderValue(String)
    HttpMediaTypeHeaderValue(String)
    HttpMediaTypeHeaderValue(String)
    HttpMediaTypeHeaderValue(String)

    Initializes a new instance of the HttpMediaTypeHeaderValue class.

    public HttpMediaTypeHeaderValue(String mediaType)public New(String mediaType)Public Sub New(mediaType As String)public HttpMediaTypeHeaderValue(String mediaType)

    Parameters

    • mediaType
      System.String
      System.String
      System.String
      System.String

      The media-type of the entity-body used in the Content-Type HTTP header.

Properties

  • CharSet
    CharSet
    CharSet
    CharSet

    Gets or sets the character set of the entity-body used in the Content-Type HTTP header.

    public string CharSet { get; set; }public string CharSet { get; set; }Public ReadWrite Property CharSet As stringpublic string CharSet { get; set; }

    Property Value

    • string
      string
      string
      string

      The character set of the entity-body.

    Remarks

    HTTP uses character set names to indicate or negotiate the character encoding scheme of a textual representation [RFC6365]. A CharSet property is identified by a case-insensitive token.

    Character set names ought to be registered in the IANA Character Set registry.

  • MediaType
    MediaType
    MediaType
    MediaType

    Gets or sets the media-type of the entity-body used in the Content-Type HTTP header.

    public string MediaType { get; set; }public string MediaType { get; set; }Public ReadWrite Property MediaType As stringpublic string MediaType { get; set; }

    Property Value

    • string
      string
      string
      string

      The media-type of the entity-body.

    Remarks

    Internet media types should be registered with IANA. Media type registrations are listed in categories by IANA as MIME Media Types.

  • Parameters
    Parameters
    Parameters
    Parameters

    Gets a set of parameters included in the Content-Type HTTP header.

    public IVector<HttpNameValueHeaderValue> Parameters { get; }public IVector<HttpNameValueHeaderValue> Parameters { get; }Public ReadOnly Property Parameters As IVector<HttpNameValueHeaderValue>public IVector<HttpNameValueHeaderValue> Parameters { get; }

    Property Value

    • A set of parameters.

    Remarks

    The Parameters property contains a set of zero or more name/value pairs associated with the MediaType.

    The CharSet property is one name/value pair. The CharSet property is a shortcut to access the value of the entry in the Parameters list whose name is charset.

Methods

  • Parse(String)
    Parse(String)
    Parse(String)
    Parse(String)

    Converts a string to an HttpMediaTypeHeaderValue instance.

    public static HttpMediaTypeHeaderValue Parse(String input)public static HttpMediaTypeHeaderValue Parse(String input)Public Static Function Parse(input As String) As HttpMediaTypeHeaderValuepublic static HttpMediaTypeHeaderValue Parse(String input)

    Parameters

    • input
      System.String
      System.String
      System.String
      System.String

      A string that represents the media-type and character set information used in the Content-Type HTTP header.

    Returns

  • ToString()
    ToString()
    ToString()
    ToString()

    Returns a string that represents the current HttpMediaTypeHeaderValue object.

    public string ToString()public string ToString()Public Function ToString() As stringpublic string ToString()

    Returns

    • string
      string
      string
      string

      A string that represents the current object.

  • TryParse(String, HttpMediaTypeHeaderValue)
    TryParse(String, HttpMediaTypeHeaderValue)
    TryParse(String, HttpMediaTypeHeaderValue)
    TryParse(String, HttpMediaTypeHeaderValue)

    Determines whether a string is valid HttpMediaTypeHeaderValue information.

    public static bool TryParse(String input, HttpMediaTypeHeaderValue mediaTypeHeaderValue)public static bool TryParse(String input, HttpMediaTypeHeaderValue mediaTypeHeaderValue)Public Static Function TryParse(input As String, mediaTypeHeaderValue As HttpMediaTypeHeaderValue) As boolpublic static bool TryParse(String input, HttpMediaTypeHeaderValue mediaTypeHeaderValue)

    Parameters

    Returns

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Web.Http.Headers.dll