語言

ServiceHealthBehavior.TryParseHttpStatusCodeQueryParameter 方法

定義

嘗試解析查詢字串變數的 HTTP 狀態碼,並回傳一個表示解析操作是否成功的值。

protected:
 static bool TryParseHttpStatusCodeQueryParameter(System::String ^ parameterName, System::String ^ parameter, System::Net::HttpStatusCode defaultErrorCode, [Runtime::InteropServices::Out] System::Net::HttpStatusCode % result);
protected static bool TryParseHttpStatusCodeQueryParameter(string parameterName, string parameter, System.Net.HttpStatusCode defaultErrorCode, out System.Net.HttpStatusCode result);
static member TryParseHttpStatusCodeQueryParameter : string * string * System.Net.HttpStatusCode * HttpStatusCode -> bool
Protected Shared Function TryParseHttpStatusCodeQueryParameter (parameterName As String, parameter As String, defaultErrorCode As HttpStatusCode, ByRef result As HttpStatusCode) As Boolean

參數

parameterName
String

方法是方法嘗試解析的參數名稱。

parameter
String

查詢字串的欄位/值對。

defaultErrorCode
HttpStatusCode

如果解析操作失敗,該參數應被指派給該參數。

result
HttpStatusCode

當方法回傳時,會返回解析後的 HTTP 狀態碼參數值。

傳回

true若解析操作成功;否則,。 false

例外狀況

parameterName 是 null。

-或-

parameter 是 null。

適用於