Share via


HeaderCollection

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

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

HeaderCollection.Add

Adds the specific Header object to the collection.

HeaderCollection.Clear

Removes all Header objects from the collection.

HeaderCollection.Contains

Determines whether the specific Header object exists in the collection.

HeaderCollection.CopyTo

Copies the entire HeaderCollection to a compatible one-dimensional array, starting at the specified index of the target array.

Equals(Object)

Inherited from System.Object. Determines whether the specified System.Object is equal to the current System.Object.

HeaderCollection.FindFirst

Finds the first occurrence of a specified header type.

HeaderCollection.GetEnumerator

Obtains an enumerator for the header collection.

GetHashCode()

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.

GetType()

Inherited from System.Object. Gets the System.Type of the current instance.

HeaderCollection.IndexOf

Returns the index of a specified Header object within the collection.

HeaderCollection.Insert

Inserts the provided Header object into the collection at the specified index.

HeaderCollection.Remove

Removes the specified Header object from the collection.

HeaderCollection.RemoveAt

Removes the Header object at the specified index from the collection.

ToString()

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

HeaderCollection.Count

Data type: Int32

Access type: Read-only

Contains the total number of Header objects in the collection.

HeaderCollection.IsFixedSize

Data type: Boolean

Accesstype: Read-only

Indicates whether the collection has a fixed size.

HeaderCollection.IsReadOnly

Data type: Boolean

Access type: Read-only

Indicates whether the collection is read-only.

HeaderCollection.IsSynchronized

Data type: Boolean

Access type: Read-only

Indicates whether access to the collection is synchronized.

HeaderCollection.Item

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.

HeaderCollection.SyncRoot

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.

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 Office Communications Server 2007 R2.

Namespace:Microsoft.Rtc.Sip

Assembly: ServerAgent (in ServerAgent.dll)

See Also

Concepts

Header