HttpCookie.TryParse(String, HttpCookie) 方法

定義

將 Cookie 的指定字串表示,轉換為其相等的 HttpCookie,並傳回一個值指出轉換是否成功。Converts the specified string representation of a cookie into its HttpCookie equivalent and returns a value that indicates whether the conversion succeeded.

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 的字串表示。The string representation of a cookie.

result
HttpCookie

如果轉換成功,就會包含HttpCookie 值,相當於 input 包含的 Cookie。If the conversion succeeded, contains the HttpCookie value equivalent to the cookie contained in input. 如果轉換失敗,result 會是 nullIf the conversion failed, result is null. 如果 input 參數是 null 或為空或無法從 input 判定 Cookie 名稱,則轉換會失敗。The conversion fails if the input parameter is null or empty or if a cookie name can't be determined from input. 方法會覆寫此參數的值,一旦輸入方法,參數會立即以傳址方式傳遞,且設定為 Null。This parameter's value is overwritten by the method; the parameter is passed by reference and set to null as soon as the method is entered.

傳回

Boolean

如果 true 轉換成功,則為 input,否則為 falsetrue if input was converted successfully; otherwise, false.

適用於