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

System.Collections.ArrayList.ToArray Method

Copies the elements of the current instance to a new array of the specified Type.

public virtual Array ToArray (Type type)

Parameters

type
The Type of the Array to create and copy the elements of the current instance.

Returns

An array of Typetype containing copies of the elements of the current instance.

Exceptions

TypeReason
ArgumentNullExceptiontype is null.
InvalidCastExceptionAt least one element of the current instance cannot be cast to the Typetype.

Remarks

Operation
As described above.

The elements are copied using Array.Copy(Array, Array, int).

Note: For the default implementation, this method is an O(n) operation, where n is the ArrayList.Count of the current instance.

Requirements

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