Windows desktop applications
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpCookieCollection class

Provides a collection container for instances of the HttpCookie class.

Syntax


var httpCookieCollection = getCookies();

Members

The HttpCookieCollection class has these types of members:

Methods

The HttpCookieCollection class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
First [C++, JavaScript]Retrieves an iterator to the first HttpCookie item in the HttpCookieCollection.
GetAt [C++, JavaScript]Returns the HttpCookie at the specified index from the HttpCookieCollection.
GetMany [C++, JavaScript]Retrieves the HttpCookie items that start at the specified index in the HttpCookieCollection.
IndexOf [C++, JavaScript]Retrieves the index of an HttpCookie in the HttpCookieCollection.

 

Properties

The HttpCookieCollection class has these properties.

PropertyAccess typeDescription

Count [C#, VB]

Read-only

Gets the number of elements that are contained in the collection.

Item [C#, VB]

Read-only

Gets the element at the specified index.

Size [C++, JavaScript]

Read-only

Gets the number of cookies in the HttpCookieCollection.

 

Remarks

The GetCookies method on HttpCookieManager returns an HttpCookieCollection object. This is the method that an HttpCookieCollection is constructed.

Enumerating the collection in C# or Microsoft Visual Basic

HttpCookieCollection is enumerable, so you can use language-specific syntax such as foreach in C# to enumerate the items in the collection. The compiler does the type-casting for you and you won't need to cast to IEnumerable<HttpCookie> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable<T> with an HttpCookie constraint.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Web.Http
Windows::Web::Http [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http
Windows::Web::Http [C++]

Metadata

Windows.winmd

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06030000)]

See also

GetCookies
HttpCookie
HttpCookieManager
IVectorView(HttpCookie)
IIterable(HttpCookie)
Object

 

 

Show:
© 2016 Microsoft