共用方式為


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 資訊。

適用於

另請參閱