ICollection<T>.CopyTo(T[], Int32) Method
Definition
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public:
void CopyTo(cli::array <T> ^ array, int arrayIndex);
public void CopyTo (T[] array, int arrayIndex);
abstract member CopyTo : 'T[] * int -> unit
Public Sub CopyTo (array As T(), arrayIndex As Integer)
Parameters
- array
- T[]
The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
- arrayIndex
- Int32
The zero-based index in array
at which copying begins.
Exceptions
array
is null
.
arrayIndex
is less than 0.
The number of elements in the source ICollection<T> is greater than the available space from arrayIndex
to the end of the destination array
.