Partilhar via


HeaderCollection class

 
Microsoft Office Live Communications Server 2005 with SP1

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
Add(Header)

Adds the specific Header object to the collection.

Clear()

Removes all Header objects from the collection.

Contains(Header)

Determines whether the specific Header object exists in the collection.

CopyTo(Array, Int32)

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.

FindFirst(String)

Finds the first occurrence of a specified header type.

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.

IndexOf(Header)

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

Insert(Int32, Header)

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

Remove(Header)

Removes the specified Header object from the collection.

RemoveAt(Int32)

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
Count Data type: Int32
Access type: Read-only

Contains the total number of Header objects in the collection.

IsFixedSize Data type: Boolean
Access type: Read-only

Indicates whether the collection has a fixed size.

IsReadOnly Data type: Boolean
Access type: Read-only

Indicates whether the collection is read-only.

IsSynchronized Data type: Boolean
Access type: Read-only

Indicates whether access to the collection is synchronized.

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.

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.

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 Live Communications Server 2003.
Namespace: Microsoft.Rtc.Sip
Assembly: ServerAgent (in ServerAgent.dll)

See Also

Header

  
  What did you think of this topic?
  © 2008 Microsoft Corporation. All rights reserved.