CodeStatementCollection.CopyTo(CodeStatement[], Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从指定的索引处开始,将对象的元素 CodeStatementCollection 复制到一维 Array 实例。
public:
void CopyTo(cli::array <System::CodeDom::CodeStatement ^> ^ array, int index);
public void CopyTo(System.CodeDom.CodeStatement[] array, int index);
member this.CopyTo : System.CodeDom.CodeStatement[] * int -> unit
Public Sub CopyTo (array As CodeStatement(), index As Integer)
参数
- array
- CodeStatement[]
一维 Array 是从集合复制的值的目标。
- index
- Int32
开始插入的数组的索引。
例外
参数 array 为 null.
参数 index 小于目标数组的最小索引。
示例
下面的示例演示如何从指定的索引值开始,将对象的内容 CodeStatementCollection 复制到数组。
// Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
// 'statements' is a CodeStatement array.
CodeStatement[] statementArray = new CodeStatement[collection.Count];
collection.CopyTo( statementArray, 0 );
' Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
' 'statements' is a CodeStatement array.
Dim statementArray(collection.Count - 1) As CodeStatement
collection.CopyTo(statementArray, 0)