語言

CodeTypeDeclarationCollection.CopyTo(CodeTypeDeclaration[], Int32) 方法

定義

將物件中的 CodeTypeDeclarationCollection 元素複製到一維 Array 實例,從指定的索引開始。

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

參數

array
CodeTypeDeclaration[]

一維 Array 值是從集合複製的值的目的地。

index
Int32

開始插入的陣列索引。

例外狀況

目的陣列是多維的。

-或-

中 CodeTypeDeclarationCollection 元素數大於參數指定 index 的目標陣列索引與目標陣列末端之間的可用空間。

參數 array 為 null。

參數 index 小於目標陣列的最小索引。

範例

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

// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeDeclaration array.
// 'declarations' is a CodeTypeDeclaration array.
collection.CopyTo( declarations, 0 );
' Copies the contents of the collection, beginning at index 0,
' to the specified CodeTypeDeclaration array.
' 'declarations' is a CodeTypeDeclaration array.
collection.CopyTo(declarations, 0)

適用於

另請參閱