SoapHeaderCollection.Insert(Int32, SoapHeader) Method

Definition

Inserts a SoapHeader into the SoapHeaderCollection at the specified index.

C#
public void Insert(int index, System.Web.Services.Protocols.SoapHeader header);

Parameters

index
Int32

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

header
SoapHeader

The SoapHeader to insert into the SoapHeaderCollection.

Exceptions

The index parameter is not a valid index in the SoapHeaderCollection.

Examples

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

Remarks

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.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also