HttpCookieCollection 类

定义

HttpCookie 类的实例提供集合容器。

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)
继承
Object Platform::Object IInspectable HttpCookieCollection
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

注解

HttpCookieManager 上的 GetCookies 方法返回 HttpCookieCollection 对象。 这是构造 HttpCookieCollection 的方法。

枚举 C# 或 Microsoft Visual Basic 中的集合

HttpCookieCollection 是可枚举的,因此可以使用特定于语言的语法(如 C# 中的 foreach )枚举集合中的项。 编译器为你执行类型强制转换,你无需显式强制转换为 IEnumerable<HttpCookie> 。 如果需要显式强制转换(例如,如果要调用 GetEnumerator),请使用 HttpCookie 约束强制转换为 IEnumerable<T>

属性

Size

获取 HttpCookieCollection 中的 Cookie 数。

方法

First()

检索 HttpCookieCollection 中第一个 HttpCookie 项的迭代器。

GetAt(UInt32)

HttpCookieCollection 返回指定索引处的 HttpCookie

GetMany(UInt32, HttpCookie[])

检索 从 HttpCookieCollection 中的指定索引处开始 的 HttpCookie 项。

IndexOf(HttpCookie, UInt32)

检索 HttpCookieCollection 中 HttpCookie 的索引。

适用于

另请参阅