Copies a range of elements from a one-dimensional Array starting at the lower bound index, and pastes them into another one-dimensional Array starting at the lower bound index.
[Visual Basic] Overloads Public Shared Sub Copy( _ ByVal sourceArray As Array, _ ByVal destinationArray As Array, _ ByVal length As Integer _ ) [C#] public static void Copy( Array sourceArray, Array destinationArray, int length ); [C++] public: static void Copy( Array* sourceArray, Array* destinationArray, int length ); [JScript] public static function Copy( sourceArray : Array, destinationArray : Array, length : int );
None.
Exception Type | Condition |
---|---|
ArgumentNullException | sourceArray is a null reference (in Visual Basic Nothing).
-or- destinationArray is a null reference (Nothing). |
RankException | sourceArray is multidimensional.
-or- destinationArray is multidimensional. |
ArrayTypeMismatchException | sourceArray and destinationArray are of incompatible types. |
InvalidCastException | At least one element in sourceArray could not be cast to destinationArray 's type. |
ArgumentOutOfRangeException | length is less than 0.
-or- length is greater than the number of elements in sourceArray. -or- length is greater than the number of elements in destinationArray. |
Both the source array and the destination array must be one-dimensional. The source array can have zero elements.
The arrays may be reference-type arrays or value-type arrays. Type-downcasting is performed, as required.
Array Class | Array Members | System Namespace | Array.Copy Overload List