Class WebHeaderCollection
Contains protocol headers associated with a request or response. Manages name-value pairs for HTTP headers.
Inheritance
Inherited Members
Namespace: Eclo.nF.SIM800H
Assembly: cs.temp.dll.dll
Syntax
public class WebHeaderCollection
Remarks
This class includes additional methods, including HTTP parsing of a collection into a buffer that can be sent.
Headers are validated when attempting to add them.
Implementation follows .NETMF System.Net.WebHeaderCollectionConstructors
WebHeaderCollection()
Creates an empty collection of WEB headers.
Declaration
public WebHeaderCollection()
Properties
AllKeys
Gets all header names (keys) in the collection.
Declaration
public string[] AllKeys { get; }
Property Value
Type | Description |
---|---|
System.String[] | An array of type String containing all header names in a Web request. |
Count
Gets the number of headers in the collection.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | An Int32 indicating the number of headers in a request. |
Item[String]
Returns the string value for the header.
Declaration
public string this[string header] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | header | The name of the header. |
Property Value
Type | Description |
---|---|
System.String | A string containing the value. If no value is present,
returns |
Methods
Add(String, String)
Inserts a header with the specified name and value into the collection.
Declaration
public void Add(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the header that is being added to the collection. |
System.String | value | The content of the header that is being added (its header-value). If a header with the specified name already exists, this value is concatenated onto the existing header. |
Remarks
If a header with the specified name already exists, the header that is being added is concatenated onto the existing header.
Throws an exception if the specified header name is the name of a special header.
GetValues(String)
Returns the values for the specified header name.
Declaration
public string[] GetValues(string header)
Parameters
Type | Name | Description |
---|---|---|
System.String | header | The name of the header. |
Returns
Type | Description |
---|---|
System.String[] | An array of parsed string objects. |
Remarks
Takes a header name and returns a string array representing the individual values for that header. For example, if the headers contain the following line:
Accept: text/plain, text/html
then GetValues("Accept")
returns an array of
two strings: "text/plain" and "text/html".
Remove(String)
Removes the specified header from the collection.
Declaration
public void Remove(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the header to remove. |
Remarks
Throws an exception if the specified header name is the name of a special header.