HttpCookieCollection Class

Definition

Provides a collection container for instances of the HttpCookie class.

public ref class HttpCookieCollection sealed : IIterable<HttpCookie ^>, IVectorView<HttpCookie ^>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class HttpCookieCollection final : IIterable<HttpCookie>, IVectorView<HttpCookie>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class HttpCookieCollection final : IIterable<HttpCookie>, IVectorView<HttpCookie>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class HttpCookieCollection : IEnumerable<HttpCookie>, IReadOnlyList<HttpCookie>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class HttpCookieCollection : IEnumerable<HttpCookie>, IReadOnlyList<HttpCookie>
Public NotInheritable Class HttpCookieCollection
Implements IEnumerable(Of HttpCookie), IReadOnlyList(Of HttpCookie)
Inheritance
Object IInspectable HttpCookieCollection
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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.

Properties

Size

Gets the number of cookies in the HttpCookieCollection.

Methods

First()

Retrieves an iterator to the first HttpCookie item in the HttpCookieCollection.

GetAt(UInt32)

Returns the HttpCookie at the specified index from the HttpCookieCollection.

GetMany(UInt32, HttpCookie[])

Retrieves the HttpCookie items that start at the specified index in the HttpCookieCollection.

IndexOf(HttpCookie, UInt32)

Retrieves the index of an HttpCookie in the HttpCookieCollection.

Applies to

See also