Click or drag to resize
ArrayListCopyTo Method (Int32, Array, Int32, Int32)
Copies a range of elements from the 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(
	int index,
	Array array,
	int arrayIndex,
	int count
)

Parameters

index
Type: SystemInt32
The zero-based index in the source ArrayList at which copying begins.
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.
count
Type: SystemInt32
The number of elements to copy.
Exceptions
ExceptionCondition
ArgumentNullExceptionarray is null.
ArgumentOutOfRangeExceptionindex is less than zero.-or- arrayIndex is less than zero.-or- count is less than zero.
ArgumentExceptionarray is multidimensional.-or- index is equal to or greater than the Count of the source ArrayList.-or- The number of elements from index to the end of 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