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 目标数组的索引与目标数组末尾之间的可用空间。

参数 arraynull.

参数 index 小于目标数组的最小索引。

示例

以下示例演示如何将 a 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)

适用于

另请参阅