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

如果转换成功,则包含等效于 input 中所含 Cookie 的 HttpCookie 值。 如果转换失败,则 resultnull。 如果 input 参数为 null 或为空,或者无法根据 input 确定 Cookie 的名称,转化将失败。 此参数的值将被方法覆盖;参数通过引用进行传递,并在输入方法后立即设置为 null。

返回

Boolean

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

适用于