Copies the entire ArrayList into a compatible one-dimensional Array, starting at the specified index of the target array.
[Visual Basic] Overloads Overridable Public Sub CopyTo( _ ByVal array As Array, _ ByVal arrayIndex As Integer _ ) [C#] public virtual void CopyTo( Array array, int arrayIndex ); [C++] public: virtual void CopyTo( Array* array, int arrayIndex ); [JScript] public function CopyTo( array : Array, arrayIndex : int );
None.
Exception Type | Condition |
---|---|
ArgumentException | array is multidimensional.
-or- The number of elements in the ArrayList is greater than the available space between arrayIndex and the end of array. |
ArgumentNullException | array is a null reference (in Visual Basic Nothing). |
ArgumentOutOfRangeException | arrayIndex is less than array 's lowbound. |
This method can be overridden by a derived class.
array must be of a compatible array type.
This method uses Copy to copy the elements.
ArrayList Class | ArrayList Members | System.Collections Namespace | ArrayList.CopyTo Overload List