HttpCookie.TryParse(String, HttpCookie) 方法

定義

將 Cookie 的指定字串表示,轉換為其相等的 HttpCookie,並傳回一個值指出轉換是否成功。

public:
 static bool TryParse(System::String ^ input, [Runtime::InteropServices::Out] System::Web::HttpCookie ^ % result);
public static bool TryParse (string input, out System.Web.HttpCookie result);
static member TryParse : string * HttpCookie -> bool
Public Shared Function TryParse (input As String, ByRef result As HttpCookie) As Boolean

參數

input
String

Cookie 的字串表示。

result
HttpCookie

如果轉換成功,就會包含HttpCookie 值,相當於 input 包含的 Cookie。 如果轉換失敗,result 會是 null。 如果 input 參數是 null 或為空或無法從 input 判定 Cookie 名稱,則轉換會失敗。 方法會覆寫此參數的值,一旦輸入方法,參數會立即以傳址方式傳遞,且設定為 Null。

傳回

Boolean

如果 input 轉換成功,則為 true,否則為 false

適用於