[Serializable] |
The restricted headers are:
ctor #1 | Overloaded:.ctor() Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the WebHeaderCollection class. |
AllKeys (inherited from System.Collections.Specialized.NameValueCollection) |
Read-only See base class member description: System.Collections.Specialized.NameValueCollection.AllKeys Gets all the keys in the NameValueCollection. |
Count (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Read-only See base class member description: System.Collections.Specialized.NameObjectCollectionBase.Count Gets the number of key-and-value pairs contained in the NameObjectCollectionBase instance. |
Item (inherited from System.Collections.Specialized.NameValueCollection) |
Read-only Overloaded: Item[int index] {get See base class member description: System.Collections.Specialized.NameValueCollection.ItemGets the entry at the specified index of the NameValueCollection. |
Item (inherited from System.Collections.Specialized.NameValueCollection) |
Read-write Overloaded: Item[string name] {get See base class member description: System.Collections.Specialized.NameValueCollection.ItemGets or sets the entry with the specified key in the NameValueCollection. |
Keys (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Read-only See base class member description: System.Collections.Specialized.NameObjectCollectionBase.Keys Gets a NameObjectCollectionBase.KeysCollection instance that contains all the keys in the NameObjectCollectionBase instance. |
Add (inherited from System.Collections.Specialized.NameValueCollection) |
Overloaded:Add(NameValueCollection c) See base class member description: System.Collections.Specialized.NameValueCollection.AddCopies the entries in the specified NameValueCollection to the current NameValueCollection. |
Add | Overloaded:Add(string header) Inserts the specified header into the collection. |
Add | Overloaded:Add(string name, string value) Overridden: Inserts a new header with the specified name and value into the collection. |
Clear (inherited from System.Collections.Specialized.NameValueCollection) |
See base class member description: System.Collections.Specialized.NameValueCollection.Clear Invalidates the cached arrays and removes all entries from the NameValueCollection. |
CopyTo (inherited from System.Collections.Specialized.NameValueCollection) |
See base class member description: System.Collections.Specialized.NameValueCollection.CopyTo Copies the entire NameValueCollection to a compatible one-dimensional Array, starting at the specified index of the target array. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
Get (inherited from System.Collections.Specialized.NameValueCollection) |
Overloaded:Get(int index) See base class member description: System.Collections.Specialized.NameValueCollection.GetGets the values at the specified index of the NameValueCollection combined into one comma-separated list. |
Get (inherited from System.Collections.Specialized.NameValueCollection) |
Overloaded:Get(string name) See base class member description: System.Collections.Specialized.NameValueCollection.GetGets the values associated with the specified key from the NameValueCollection combined into one comma-separated list. |
GetEnumerator (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.GetEnumerator Returns an enumerator that can iterate through the NameObjectCollectionBase. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetKey (inherited from System.Collections.Specialized.NameValueCollection) |
See base class member description: System.Collections.Specialized.NameValueCollection.GetKey Gets the key at the specified index of the NameValueCollection. |
GetObjectData (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.GetObjectData Implements the ISerializable interface and returns the data needed to serialize the NameObjectCollectionBase instance. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
GetValues (inherited from System.Collections.Specialized.NameValueCollection) |
Overloaded:GetValues(int index) See base class member description: System.Collections.Specialized.NameValueCollection.GetValuesGets the values at the specified index of the NameValueCollection. |
GetValues | Overloaded:GetValues(string header) Overridden: Gets an array of header values stored in a header. |
HasKeys (inherited from System.Collections.Specialized.NameValueCollection) |
See base class member description: System.Collections.Specialized.NameValueCollection.HasKeys Gets a value indicating whether the NameValueCollection contains keys that are not null. |
IsRestricted | Tests whether the specified HTTP header can be set. |
OnDeserialization | Overridden: Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code |
Remove | Overridden: Removes the specified header from the collection. |
Set | Overridden: Sets the specified header to the specified value. |
ToByteArray | Obsolete. |
ToString | Overridden: Obsolete. |
ctor #2 | Overloaded:.ctor(SerializationInfo serializationInfo, StreamingContext streamingContext) Initializes a new instance of the WebHeaderCollection class from the specified instances of the SerializationInfo and StreamingContext classes. |
IsReadOnly (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Read-write See base class member description: System.Collections.Specialized.NameObjectCollectionBase.IsReadOnly Gets or sets a value indicating whether the NameObjectCollectionBase instance is read-only. |
AddWithoutValidate | Inserts a header into the collection without checking whether the header is on the restricted header list. |
BaseAdd (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseAdd Adds an entry with the specified key and value into the NameObjectCollectionBase instance. |
BaseClear (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseClear Removes all entries from the NameObjectCollectionBase instance. |
BaseGet (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Overloaded:BaseGet(int index) See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseGetGets the value of the entry at the specified index of the NameObjectCollectionBase instance. |
BaseGet (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Overloaded:BaseGet(string name) See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseGetGets the value of the first entry with the specified key from the NameObjectCollectionBase instance. |
BaseGetAllKeys (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseGetAllKeys Returns a String array that contains all the keys in the NameObjectCollectionBase instance. |
BaseGetAllValues (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Overloaded:BaseGetAllValues() See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseGetAllValuesReturns an Object array that contains all the values in the NameObjectCollectionBase instance. |
BaseGetAllValues (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Overloaded:BaseGetAllValues(Type type) See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseGetAllValuesReturns an array of the specified type that contains all the values in the NameObjectCollectionBase instance. |
BaseGetKey (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseGetKey Gets the key of the entry at the specified index of the NameObjectCollectionBase instance. |
BaseHasKeys (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys Gets a value indicating whether the NameObjectCollectionBase instance contains entries whose keys are not null. |
BaseRemove (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseRemove Removes the entries with the specified key from the NameObjectCollectionBase instance. |
BaseRemoveAt (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseRemoveAt Removes the entry at the specified index of the NameObjectCollectionBase instance. |
BaseSet (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Overloaded:BaseSet(int index, object value) See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseSetSets the value of the entry at the specified index of the NameObjectCollectionBase instance. |
BaseSet (inherited from System.Collections.Specialized.NameObjectCollectionBase) |
Overloaded:BaseSet(string name, object value) See base class member description: System.Collections.Specialized.NameObjectCollectionBase.BaseSetSets the value of the first entry with the specified key in the NameObjectCollectionBase instance, if found; otherwise, adds an entry with the specified key and value into the NameObjectCollectionBase instance. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
InvalidateCachedArrays (inherited from System.Collections.Specialized.NameValueCollection) |
See base class member description: System.Collections.Specialized.NameValueCollection.InvalidateCachedArrays Resets the cached arrays of the collection to null. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public WebHeaderCollection(); |
protected WebHeaderCollection( |
serializationInfo
streamingContext
public virtual string[] AllKeys {get;}
|
The arrays returned by NameValueCollection.AllKeys are cached for better performance and are automatically refreshed when the collection changes. A derived class can invalidate the cached version by calling NameValueCollection.InvalidateCachedArrays, thereby forcing the arrays to be recreated.
public virtual int Count {get;}
|
protected bool IsReadOnly {get; set;}
|
public string this[int index] {get;}
|
index
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
myCollection[index]
. This property cannot be set. To set the value at a specified index, use
Item[GetKey(index)]
.
public string this[string name] {get; set;}
|
name
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
NotSupportedException | The collection is read-only and the operation attempts to modify the collection. |
myCollection[name]
.If the specified key already exists in the collection, setting this property overwrites the existing values with the specified value. To add the new value to the existing list of values, use the NameValueCollection.Add method.
If the specified key does not exist in the collection, setting this property creates a new entry using the specified key and the specified value.
public virtual NameObjectCollectionBase.KeysCollection Keys {get;}
|
public void Add( |
c
Exception Type | Condition |
---|---|
NotSupportedException | The collection is read-only. |
ArgumentNullException | col is null. |
public void Add( |
header
Exception Type | Condition |
---|---|
ArgumentNullException | header is blank. |
ArgumentException | header does not contain a colon (:) character -or- header is a restricted header that should be set with a property. -or- header is an invalid HTTP header name. |
If the header specified in header is already present in the collection, value is concatenated with the existing value.
name
value
Exception Type | Condition |
---|---|
ArgumentNullException | name is blank. |
ArgumentException | header is a restricted header that must be set with a property setting. -or- header is an invalid HTTP header name. |
If the header specified in header is already present, value is concatenated with the existing value.
headerName
headerValue
name
value
Exception Type | Condition |
---|---|
NotSupportedException | The collection is read-only. |
protected void BaseClear(); |
Exception Type | Condition |
---|---|
NotSupportedException | The collection is read-only. |
index
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
name
protected string[] BaseGetAllKeys(); |
protected object[] BaseGetAllValues(); |
type
Exception Type | Condition |
---|---|
ArgumentNullException | type is null. |
ArgumentException | type is not a valid Type. |
index
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
protected bool BaseHasKeys(); |
protected void BaseRemove( |
name
Exception Type | Condition |
---|---|
NotSupportedException | The collection is read-only. -or- The collection has a fixed size. |
protected void BaseRemoveAt( |
index
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
NotSupportedException | The collection is read-only. -or- The collection has a fixed size. |
index
value
Exception Type | Condition |
---|---|
NotSupportedException | The collection is read-only. |
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
name
value
Exception Type | Condition |
---|---|
NotSupportedException | The collection is read-only. |
public void Clear(); |
Exception Type | Condition |
---|---|
NotSupportedException | The collection is read-only. |
dest
index
Exception Type | Condition |
---|---|
ArgumentNullException | dest is null. |
ArgumentOutOfRangeException | index is less than zero. |
ArgumentException | dest is multidimensional. -or- index is equal to or greater than the length of dest. -or- The number of elements in the source NameValueCollection is greater than the available space from index to the end of the destination dest. |
InvalidCastException | The type of the source NameValueCollection cannot be cast automatically to the type of the destination dest. |
This method uses Array.Copy to copy the elements.
~WebHeaderCollection(); |
index
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
name
public IEnumerator GetEnumerator(); |
Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection.
Initially, the enumerator is positioned before the first element in the collection. IEnumerator.Reset also brings the enumerator back to this position. At this position, calling IEnumerator.Current throws an exception. Therefore, you must call IEnumerator.MoveNext to advance the enumerator to the first element of the collection before reading the value of IEnumerator.Current.
IEnumerator.Current returns the same object until either IEnumerator.MoveNext or IEnumerator.Reset is called. IEnumerator.MoveNext sets IEnumerator.Current to the next element.
After the end of the collection is passed, the enumerator is positioned after the last element in the collection, and calling IEnumerator.MoveNext returns false. If the last call to IEnumerator.MoveNext returned false, calling IEnumerator.Current throws an exception. To set IEnumerator.Current to the first element of the collection again, you can call IEnumerator.Reset followed by IEnumerator.MoveNext.
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying or deleting elements, the enumerator is irrecoverably invalidated and the next call to IEnumerator.MoveNext or IEnumerator.Reset throws an InvalidOperationException. If the collection is modified between IEnumerator.MoveNext and IEnumerator.Current, IEnumerator.Current will return the element that it is set to, even if the enumerator is already invalidated.
The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads could still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
public virtual int GetHashCode(); |
index
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
public virtual void GetObjectData( |
info
context
Exception Type | Condition |
---|---|
ArgumentNullException | info is null. |
public Type GetType(); |
index
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is outside the valid range of indexes for the collection. |
header
public bool HasKeys(); |
protected void InvalidateCachedArrays(); |
headerName
Exception Type | Condition |
---|---|
ArgumentNullException | headerName is null. |
protected object MemberwiseClone(); |
public override void OnDeserialization( |
sender
public override void Remove( |
name
Exception Type | Condition |
---|---|
ArgumentNullException | name is null. |
ArgumentException | name is a restricted header. |
name
value
Exception Type | Condition |
---|---|
ArgumentNullException | name is null. |
ArgumentException | name is a restricted header. |
If the header specified in header is already present, value replaces the existing value.
public byte[] ToByteArray(); |
public override string ToString(); |