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