WebHeaderCollection 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
包含與要求或回應關聯的通訊協定 (Protocol) 標頭。
public ref class WebHeaderCollection sealed : System::Collections::IEnumerable
public ref class WebHeaderCollection : System::Collections::Specialized::NameValueCollection, System::Runtime::Serialization::ISerializable
public ref class WebHeaderCollection : System::Collections::Specialized::NameValueCollection
public sealed class WebHeaderCollection : System.Collections.IEnumerable
public class WebHeaderCollection : System.Collections.Specialized.NameValueCollection, System.Runtime.Serialization.ISerializable
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class WebHeaderCollection : System.Collections.Specialized.NameValueCollection, System.Runtime.Serialization.ISerializable
public class WebHeaderCollection : System.Collections.Specialized.NameValueCollection
type WebHeaderCollection = class
interface IEnumerable
type WebHeaderCollection = class
inherit NameValueCollection
interface IEnumerable
interface ISerializable
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type WebHeaderCollection = class
inherit NameValueCollection
interface ISerializable
type WebHeaderCollection = class
inherit NameValueCollection
interface ISerializable
Public NotInheritable Class WebHeaderCollection
Implements IEnumerable
Public Class WebHeaderCollection
Inherits NameValueCollection
Implements ISerializable
Public Class WebHeaderCollection
Inherits NameValueCollection
- 繼承
-
WebHeaderCollection
- 繼承
- 屬性
- 實作
類別 WebHeaderCollection 通常會透過 WebRequest.Headers 或 WebResponse.Headers存取。
在 .NET Framework 上,某些常見的標頭會被視為受限制,而且會由 API 直接公開 (,例如 Content-Type
) 或受系統保護,而且無法變更。 這 不適用於 .NET Core 和 .NET 5+,其中沒有任何標頭受到限制。
受限制的標頭如下:
接受
連線
Content-Length
Content-Type
Date
Expect
Host
If-Modified-Since
範圍
Referer
Transfer-Encoding
User-Agent
Proxy-Connection
Web |
初始化 WebHeaderCollection 類別的新執行個體。 |
Web |
已淘汰.
初始化 WebHeaderCollection 類別的新執行個體,這個執行個體是來自 SerializationInfo 和 StreamingContext 類別的指定執行個體。 |
All |
取得集合中的所有標頭名稱 (索引鍵)。 |
Count |
取得集合中的標頭數目。 |
Is |
取得或設定值,表示 NameObjectCollectionBase 執行個體是否為唯讀。 (繼承來源 NameObjectCollectionBase) |
Item[Http |
取得或設定指定的要求標頭。 |
Item[Http |
取得或設定指定的回應標頭。 |
Item[Int32] |
取得 NameValueCollection 之指定索引處的項目。 (繼承來源 NameValueCollection) |
Item[String] |
包含與要求或回應關聯的通訊協定 (Protocol) 標頭。 |
Item[String] |
取得或設定具有 NameValueCollection 中指定索引鍵的項目。 (繼承來源 NameValueCollection) |
Keys |
取得集合中的標頭名稱 (索引鍵) 集合。 |
ICollection. |
從目標陣列的指定索引開始,將整個 NameObjectCollectionBase 複製到相容的一維 Array。 (繼承來源 NameObjectCollectionBase) |
ICollection. |
取得值,表示是否要同步處理 (執行緒安全) 對 NameObjectCollectionBase 物件的存取。 (繼承來源 NameObjectCollectionBase) |
ICollection. |
取得可用來同步處理對 NameObjectCollectionBase 物件之存取的物件。 (繼承來源 NameObjectCollectionBase) |
IEnumerable. |
傳回可以逐一查看 WebHeaderCollection 執行個體的列舉值。 |
ISerializable. |
將這個執行個體序列化為指定的 SerializationInfo 物件。 |
Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
Of |
根據指定的型別來篩選 IEnumerable 的項目。 |
As |
啟用查詢的平行化作業。 |
As |
將 IEnumerable 轉換成 IQueryable。 |
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |