共用方式為


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 點後的專案會向下移動以容納新的專案。

適用於

另請參閱