Click or drag to resize
ArrayListCopyTo Method (Array, Int32)
Copies the entire ArrayList to a compatible one-dimensional Array, starting at the specified index of the target array.

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public virtual void CopyTo(
	Array array,
	int arrayIndex
)

Parameters

array
Type: SystemArray
The one-dimensional Array that is the destination of the elements copied from ArrayList. The Array must have zero-based indexing.
arrayIndex
Type: SystemInt32
The zero-based index in array at which copying begins.

Implements

ICollectionCopyTo(Array, Int32)
Exceptions
ExceptionCondition
ArgumentNullExceptionarray is null.
ArgumentOutOfRangeExceptionarrayIndex is less than zero.
ArgumentExceptionarray is multidimensional.-or- The number of elements in the source ArrayList is greater than the available space from arrayIndex to the end of the destination array.
InvalidCastExceptionThe type of the source ArrayList cannot be cast automatically to the type of the destination array.
See Also