Mono Class Library: System.Collections.ArrayList Overview | Members

System.Collections.ArrayList.CopyTo Method

Copies the elements from the current instance to the specified Array.

public virtual void CopyTo (Array array)

Parameters

array
The one-dimensional Array that is the destination of the elements copied from the current instance. The Array.Length of this array is greater than or equal to the ArrayList.Count of the current instance.

Exceptions

TypeReason
ArgumentNullExceptionarray is null.
ArgumentException

array has more than one dimension.

-or-

ArrayList.Count of the current instance > array.Length.

InvalidCastExceptionAt least one element in the current instance is not assignment-compatible with the type of array.

Remarks

Operation
As described above.

This method uses Array.Copy(Array, Array, int) to copy the current instance to array.

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0