共用方式為


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)

擷取HttpCookieCollectionHttpCookie的索引。

適用於

另請參閱