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

Applies to Windows and Windows Phone

Provides a collection container for instances of the HttpCookie class.

Syntax


var httpCookieCollection = getCookies();

Attributes

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

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-onlyGets the number of elements that are contained in the collection.

Item [C#, VB]

Read-onlyGets the element at the specified index.

Size [C++, JavaScript]

Read-onlyGets 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

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

See also

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

 

 

Show:
© 2014 Microsoft