CollectionBase.ICollection.CopyTo(Array, Int32) Methode
Definition
Kopiert die gesamte CollectionBase-Instanz in ein kompatibles eindimensionales Array, beginnend am angegebenen Index des Zielarrays.Copies the entire CollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array.
virtual void System.Collections.ICollection.CopyTo(Array ^ array, int index) = System::Collections::ICollection::CopyTo;
void ICollection.CopyTo (Array array, int index);
abstract member System.Collections.ICollection.CopyTo : Array * int -> unit
override this.System.Collections.ICollection.CopyTo : Array * int -> unit
Sub CopyTo (array As Array, index As Integer) Implements ICollection.CopyTo
Parameter
- array
- Array
Das eindimensionale Array, das das Ziel der aus der CollectionBase kopierten Elemente ist.The one-dimensional Array that is the destination of the elements copied from CollectionBase. Für das Array muss eine nullbasierte Indizierung verwendet werden.The Array must have zero-based indexing.
- index
- Int32
Der nullbasierte Index im array
, bei dem der Kopiervorgang beginnt.The zero-based index in array
at which copying begins.
Implementiert
Ausnahmen
array
ist null
.array
is null
.
index
ist kleiner als Null.index
is less than zero.
array
ist mehrdimensional.array
is multidimensional.
- oder --or-
Die Anzahl der Elemente in der Quell-CollectionBase ist größer als der verfügbare Platz vom index
bis zum Ende des Ziel-array
s.The number of elements in the source CollectionBase is greater than the available space from index
to the end of the destination array
.
Der Typ der Quell-CollectionBase kann nicht automatisch in den Typ des Ziel-array
umgewandelt werden.The type of the source CollectionBase cannot be cast automatically to the type of the destination array
.
Hinweise
Das angegebene Array muss einen kompatiblen Typ aufweisen.The specified array must be of a compatible type.
Diese Methode verwendet Array.Copy , um die Elemente zu kopieren.This method uses Array.Copy to copy the elements.
Diese Methode ist ein O(n)
Vorgang, bei dem gleich n
ist Count .This method is an O(n)
operation, where n
is Count.