HttpMediaTypeHeaderValue 类

定义

表示请求或响应中 HTTP 内容上的 Content-Type HTTP 标头的值。

public ref class HttpMediaTypeHeaderValue sealed : IStringable
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.Headers.IHttpMediaTypeHeaderValueFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class HttpMediaTypeHeaderValue final : IStringable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.Headers.IHttpMediaTypeHeaderValueFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class HttpMediaTypeHeaderValue final : IStringable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.Headers.IHttpMediaTypeHeaderValueFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class HttpMediaTypeHeaderValue : IStringable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.Headers.IHttpMediaTypeHeaderValueFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpMediaTypeHeaderValue : IStringable
function HttpMediaTypeHeaderValue(mediaType)
Public NotInheritable Class HttpMediaTypeHeaderValue
Implements IStringable
继承
Object Platform::Object IInspectable HttpMediaTypeHeaderValue
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

注解

HttpMediaTypeHeaderValue 类表示在 HTTP 请求中发送或在 HTTP 响应中接收的 HTTP 内容的 Content-Type HTTP 标头的值。

HttpContentHeaderCollection 上的 ContentType 属性返回 HttpMediaTypeHeaderValue 对象。

构造函数

HttpMediaTypeHeaderValue(String)

初始化 HttpMediaTypeHeaderValue 类的新实例。

属性

CharSet

获取或设置 Content-Type HTTP 标头中使用的实体正文的字符集。

MediaType

获取或设置 Content-Type HTTP 标头中使用的实体正文的媒体 类型

Parameters

获取 Content-Type HTTP 标头中包含的一组参数。

方法

Parse(String)

将字符串转换为 HttpMediaTypeHeaderValue 实例。

ToString()

返回表示当前 HttpMediaTypeHeaderValue 对象的字符串。

TryParse(String, HttpMediaTypeHeaderValue)

确定字符串是否为有效的 HttpMediaTypeHeaderValue 信息。

适用于

另请参阅