共用方式為


HttpMethod 類別

定義

擷取 GET 和 POST 等標準 HTTP 方法,並建立新的 HTTP 方法。

public ref class HttpMethod sealed : IStringable
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.IHttpMethodFactory, 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 HttpMethod 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.IHttpMethodFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class HttpMethod final : IStringable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.IHttpMethodFactory), 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 HttpMethod : 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.IHttpMethodFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpMethod : IStringable
function HttpMethod(method)
Public NotInheritable Class HttpMethod
Implements IStringable
繼承
Object Platform::Object IInspectable HttpMethod
屬性
實作

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

備註

最常見的 HttpMethod 用法是從這個類別的屬性取得標準 HTTP 方法 (動詞) 。 不過,如果應用程式需要 HTTP 方法的不同值,HttpMethod 建構函式會使用應用程式開發人員指定的 HTTP 方法,初始化 HttpMethod 的新實例。

建構函式

HttpMethod(String)

使用特定的 HTTP 方法,初始化 HttpMethod 類別的新實例。

屬性

Delete

取得 HTTP DELETE 方法。

Get

取得 HTTP GET 方法。

Head

取得 HTTP HEAD 方法。

Method

取得 HTTP 方法。

Options

取得 HTTP OPTIONS 方法。

Patch

取得 HTTP PATCH 方法,

Post

取得 HTTP POST 方法。

Put

取得 HTTP PUT 方法。

方法

ToString()

會傳回代表目前 HttpMethod 物件的字串。

適用於

另請參閱