CompilerErrorCollection.CopyTo(CompilerError[], Int32) 方法

定義

將集合值複製到指定索引的一維 Array 執行個體。

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

參數

array
CompilerError[]

複製自 CompilerErrorCollection 之值的目的地一維 Array

index
Int32

要在該處開始複製的陣列索引。

例外狀況

array 參數所表示的陣列是多維的。

-或-

CompilerErrorCollection 中的元素數,大於 arrayIndex 參數表示陣列的 array 參數的索引值與 array 參數所表示陣列的結尾之間的可用空間。

array 參數為 null

index 參數小於 array 參數所表示的陣列下限。

範例

下列範例示範如何使用 CopyTo 方法,從指定的索引值開始,將 的內容 CompilerErrorCollection 複製到陣列。

// Copies the contents of the collection, beginning at index 0,
// to the specified CompilerError array.
// 'errors' is a CompilerError array.
collection->CopyTo( errors, 0 );
// Copies the contents of the collection, beginning at index 0,
// to the specified CompilerError array.
// 'errors' is a CompilerError array.
collection.CopyTo( errors, 0 );
' Copies the contents of the collection, beginning at index 0, 
' to the specified CompilerError array.
' 'errors' is a CompilerError array.
collection.CopyTo(errors, 0)

適用於

另請參閱