SoapHeaderCollection.Insert(Int32, SoapHeader) 方法

定义

SoapHeader 插入到 SoapHeaderCollection 中的指定索引位置处。

public:
 void Insert(int index, System::Web::Services::Protocols::SoapHeader ^ header);
public void Insert (int index, System.Web.Services.Protocols.SoapHeader header);
member this.Insert : int * System.Web.Services.Protocols.SoapHeader -> unit
Public Sub Insert (index As Integer, header As SoapHeader)

参数

index
Int32

从零开始的索引,将在该处将 SoapHeader 插入 SoapHeaderCollection 中。

header
SoapHeader

要插入到 SoapHeaderCollectionSoapHeader

例外

index 参数不是 SoapHeaderCollection 中的有效索引。

示例

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

注解

index如果参数等于集合中的项数,则将SoapHeader追加到集合末尾。

SoapHeader插入点下移以容纳新元素的元素。

适用于

另请参阅