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)

适用于

另请参阅