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 与包含在中的 inputCookie 等效的值。 如果转换失败, result 则为 null. 如果 input 参数为 null 空或无法确定 inputCookie 名称,则转换失败。 此方法覆盖此参数的值;参数通过引用传递,并在输入方法后立即设置为 null。

返回

true 如果 input 已成功转换,则为 :否则为 false

适用于