CodeCommentStatementCollection.CopyTo(CodeCommentStatement[], Int32) 方法

定義

將集合物件複製到開始於指定索引的指定一維 Array

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

參數

array
CodeCommentStatement[]

一維 Array,是從集合複製之值的目的端。

index
Int32

要開始插入的陣列索引。

例外狀況

目的端陣列為多維。

-或-

CodeCommentStatementCollection 中的元素數目大於由 index 參數指定的目標陣列索引和目標陣列結尾之間的可用空間。

array 參數為 null

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

範例

下列範例示範如何將 的內容 CodeCommentStatementCollection 複製到從索引值 0 開始的陣列。

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

適用於

另請參閱