SoapHeaderCollection.Insert Method
Inserts a SoapHeader into the SoapHeaderCollection at the specified index.
[Visual Basic] Public Sub Insert( _ ByVal index As Integer, _ ByVal header As SoapHeader _ ) [C#] public void Insert( int index, SoapHeader header ); [C++] public: void Insert( int index, SoapHeader* header ); [JScript] public function Insert( index : int, header : SoapHeader );
Parameters
- index
- The zero-based index at which to insert the SoapHeader into the SoapHeaderCollection.
- header
- The SoapHeader to insert into the SoapHeaderCollection.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentOutOfRangeException | The index parameteris not a valid index in the SoapHeaderCollection. |
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.
Example
[Visual Basic] mySoapHeader = New MySoapHeader() mySoapHeader.text = "This header is inserted before the first header" mySoapHeaderCollection.Insert(0, mySoapHeader) [C#] mySoapHeader = new MySoapHeader(); mySoapHeader.text = "This header is inserted before the first header"; mySoapHeaderCollection.Insert(0, mySoapHeader); [C++] mySoapHeader = new MySoapHeader(); mySoapHeader->text = S"This header is inserted before the first header"; mySoapHeaderCollection->Insert(0, mySoapHeader);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
SoapHeaderCollection Class | SoapHeaderCollection Members | System.Web.Services.Protocols Namespace | Insert | IList | SoapHeader | CollectionBase