SortedDictionary<TKey,TValue>.ValueCollection.ICollection.CopyTo(Array, Int32) Método
Definición
Copia los elementos de ICollection en una matriz, comenzando en un índice concreto de la matriz.Copies the elements of the ICollection to an array, starting at a particular array index.
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
Parámetros
- array
- Array
Matriz unidimensional que constituye el destino de los elementos copiados desde ICollection.The one-dimensional array that is the destination of the elements copied from the ICollection. La matriz debe tener una indización de base cero.The array must have zero-based indexing.
- index
- Int32
Índice de base cero en la array
donde comienza la copia.The zero-based index in array
at which copying begins.
Implementaciones
Excepciones
array
es null
.array
is null
.
index
es menor que 0.index
is less than 0.
array
es multidimensional.array
is multidimensional.
o bien-or-
array
no tiene una indización de base cero.array
does not have zero-based indexing.
o bien-or-
El número de elementos de la ICollection de origen es mayor que el espacio disponible desde index
hasta el final de la array
de destino.The number of elements in the source ICollection is greater than the available space from index
to the end of the destination array
.
o bien-or-
El tipo de la ICollection de origen no puede convertirse automáticamente al tipo de la array
de destino.The type of the source ICollection cannot be cast automatically to the type of the destination array
.
Comentarios
Nota
Si el tipo del origen ICollection no se puede convertir automáticamente al tipo de destino array
, las implementaciones no genéricas de ICollection.CopyTo inician InvalidCastException , mientras que las implementaciones genéricas inician ArgumentException .If the type of the source ICollection cannot be cast automatically to the type of the destination array
, the nongeneric implementations of ICollection.CopyTo throw an InvalidCastException, whereas the generic implementations throw an ArgumentException.
Este método es una operación O ( n
), donde n
es Count .This method is an O(n
) operation, where n
is Count.