Copies the entire ArrayList to a compatible one-dimensional Array, starting at the specified index of the target array.
Type Reason ArgumentNullException array is null. ArgumentOutOfRangeException arrayIndex < 0. ArgumentException array has more than one dimension.
-or-
arrayIndex >= array.Length.
-or-
arrayIndex + ArrayList.Count of the current instance > array.Length.
InvalidCastException At least one element in the current instance is not assignment-compatible with the type of array.
The specified array must be of a compatible type.
This method uses erload:System.Array.Copy to copy the elements.
The elements are copied to the Array in the same order in which the enumerator iterates through the ArrayList.
This method is an O(n) operation, where n is ArrayList.Count.