語言

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)

適用於

另請參閱