Редагувати

Поділитися через


ICollectionContract<C>.CopyTo(C[], Int32) Method

Definition

Copies the entire ICollectionContract<C> to a compatible one-dimensional array, starting at the specified index of the target array.

public:
 void CopyTo(cli::array <C> ^ array, int arrayIndex);
public void CopyTo (C[] array, int arrayIndex);
abstract member CopyTo : 'C[] * int -> unit
Public Sub CopyTo (array As C(), arrayIndex As Integer)

Parameters

array
C[]

The one-dimensional array that is the destination of the elements copied from the ICollectionContract<C>.

arrayIndex
Int32

The zero-based index in array at which copying begins.

Exceptions

array is null.

arrayIndex is less than 0.

array is multidimensional.

-or-

The number of elements in the source ICollectionContract<C> is greater than the available space from arrayIndex to the end of the destination array.

-or-

Type C cannot be cast automatically to the type of the destination array.

Applies to