HeaderCollection
The HeaderCollection class defines the collection of header fields in any given SIP message.
This class implements the IEnumerable and ICollection interfaces.
The HeaderCollection class is derived from the System.Object class.
Public Methods
The HeaderCollection class has the following public methods.
Method |
Description |
---|---|
Adds the specific Header object to the collection. |
|
Removes all Header objects from the collection. |
|
Determines whether the specific Header object exists in the collection. |
|
Copies the entire HeaderCollection to a compatible one-dimensional array, starting at the specified index of the target array. |
|
Inherited from System.Object. Determines whether the specified System.Object is equal to the current System.Object. |
|
Finds the first occurrence of a specified header type. |
|
Obtains an enumerator for the header collection. |
|
Inherited from System.Object. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. |
|
Inherited from System.Object. Gets the System.Type of the current instance. |
|
Returns the index of a specified Header object within the collection. |
|
Inserts the provided Header object into the collection at the specified index. |
|
Removes the specified Header object from the collection. |
|
Removes the Header object at the specified index from the collection. |
|
Inherited from System.Object. Returns a System.String that represents the current System.Object. |
Public Properties
The HeaderCollection class has the following public properties.
Property |
Description |
---|---|
Data type: Int32 Access type: Read-only Contains the total number of Header objects in the collection. |
|
Data type: Boolean Accesstype: Read-only Indicates whether the collection has a fixed size. |
|
Data type: Boolean Access type: Read-only Indicates whether the collection is read-only. |
|
Data type: Boolean Access type: Read-only Indicates whether access to the collection is synchronized. |
|
Data type: Header Access type: Read/write Contains the Header element at the specified index. In C#, this property is the indexer for the HeaderCollection class. |
|
Data type: Object Access type: Read-only Contains an object used to synchronize access to the collection. This implementation always returns the current instance of the HeaderCollection object. |
Example Code
The following code sample iterates through a HeaderCollection and writes the header type along with its associated value. In this case, the HeaderCollection is the AllHeaders property set on an incoming Request Sip Class.
Copy Code | |
---|---|
public void OnRequest(object sender, RequestReceivedEventArgs rreArgs) { Request r = rreArgs.Request; HeaderCollection headers = r.AllHeaders; foreach (Header header in headers) { Console.WriteLine("{0}: {1}", header.Type, header.Value); } } |
Requirements
Redistributable: Requires Microsoft Lync Server 2010
Namespace:Microsoft.Rtc.Sip
Assembly: ServerAgent (in ServerAgent.dll)