BindingContext.ICollection.CopyTo(Array, Int32) 方法

定义

将集合中的元素复制到指定数组,从集合索引处开始。

 virtual void System.Collections.ICollection.CopyTo(Array ^ ar, int index) = System::Collections::ICollection::CopyTo;
void ICollection.CopyTo (Array ar, int index);
abstract member System.Collections.ICollection.CopyTo : Array * int -> unit
override this.System.Collections.ICollection.CopyTo : Array * int -> unit
Sub CopyTo (ar As Array, index As Integer) Implements ICollection.CopyTo

参数

ar
Array

要复制到的 Array

index
Int32

复制起始位置的集合索引。

实现

示例

private:
   void CopyToArray()
   {
      // Declare the array.
      array<Object^>^ myArray = gcnew array<Object^>(100);
      ( (ICollection^)(this->BindingContext) )->CopyTo( myArray, 0 );
   }
private void CopyToArray(){
   // Declare the array.
   object [] myArray = new object [100];
   ((ICollection)this.BindingContext).CopyTo(myArray, 0);
}
Private Sub CopyToArray()
    ' Declare the array.
    Dim myArray(100) As Object
    CType(Me.BindingContext, ICollection).CopyTo(myArray, 0)
End Sub

适用于