本文整理匯總了C#中System.Web.HttpCookie.ThrowIfNull方法的典型用法代碼示例。如果您正苦於以下問題:C# HttpCookie.ThrowIfNull方法的具體用法?C# HttpCookie.ThrowIfNull怎麽用?C# HttpCookie.ThrowIfNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.HttpCookie
的用法示例。
在下文中一共展示了HttpCookie.ThrowIfNull方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Cookie
public Cookie(HttpCookie cookie, bool shareable = false)
{
cookie.ThrowIfNull("cookie");
_name = cookie.Name;
_path = cookie.Path;
_secure = cookie.Secure;
_shareable = shareable;
_httpOnly = cookie.HttpOnly;
_domain = cookie.Domain;
_expires = cookie.Expires;
_value = cookie.Value;
IEnumerable<CookieValue> cookieValues = cookie.Values.AllKeys
.Where(arg => arg != null)
.Select(arg => new CookieValue(arg, cookie.Values[arg]));
_values.AddRange(cookieValues);
}
示例2: Cookie
public Response Cookie(HttpCookie cookie, bool shareable = false)
{
cookie.ThrowIfNull("cookie");
_cookies.Add(new Cookie(cookie, shareable));
return this;
}