BindingContext.ICollection.CopyTo(Array, Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將集合的項目複製到指定的陣列中 (從集合索引開始)。
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
參數
- 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