SoapHeaderCollection.Insert Method (Int32, SoapHeader)


Inserts a SoapHeader into the SoapHeaderCollection at the specified index.

Namespace:   System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public void Insert(
	int index,
	SoapHeader header


Type: System.Int32

The zero-based index at which to insert the SoapHeader into the SoapHeaderCollection.

Type: System.Web.Services.Protocols.SoapHeader

The SoapHeader to insert into the SoapHeaderCollection.

Exception Condition

The index parameteris not a valid index in the SoapHeaderCollection.

If the index parameter equals the number of items in the collection, then the SoapHeader is appended to the end of the collection.

The SoapHeader elements after the insertion point move down to accommodate the new element.

mySoapHeader = new MySoapHeader();
mySoapHeader.text = "This header is inserted before the first header";
mySoapHeaderCollection.Insert(0, mySoapHeader);

.NET Framework
Available since 1.1
Return to top