Share via


SoapHeaderCollection.CopyTo(SoapHeader[], Int32) 方法

定義

SoapHeaderCollection 的特定索引開始,將 Array 的項目複製到 Array

public:
 void CopyTo(cli::array <System::Web::Services::Protocols::SoapHeader ^> ^ array, int index);
public void CopyTo (System.Web.Services.Protocols.SoapHeader[] array, int index);
member this.CopyTo : System.Web.Services.Protocols.SoapHeader[] * int -> unit
Public Sub CopyTo (array As SoapHeader(), index As Integer)

參數

array
SoapHeader[]

一維 Array,是從 SoapHeaderCollection 複製過來之項目的目的端。 陣列必須有以零為起始的索引。

index
Int32

array 參數中以零起始的索引,位於複製開始的位置。

例外狀況

array 參數為 null

index 參數小於零。

array 是多維參數。

-或- 來源 SoapHeaderCollection 中的項目數目大於從 index 參數至目的陣列結尾的可用空間。

範例

mySoapHeaders = gcnew array<MySoapHeader^>(mySoapHeaderCollection->Count);
mySoapHeaderCollection->CopyTo( mySoapHeaders, 0 );
mySoapHeaders = new MySoapHeader[mySoapHeaderCollection.Count];
mySoapHeaderCollection.CopyTo(mySoapHeaders, 0);
mySoapHeaders = New MySoapHeader(mySoapHeaderCollection.Count-1) {}
mySoapHeaderCollection.CopyTo(mySoapHeaders, 0)

適用於

另請參閱