ArrayCopy Method (Array, Int64, Array, Int64, Int64) |
Copies a range of elements from an
Array starting at the specified source index and pastes them to another
Array starting at the specified destination index. The length and the indexes are specified as 64-bit integers.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static void Copy(
Array sourceArray,
long sourceIndex,
Array destinationArray,
long destinationIndex,
long length
)
Parameters
- sourceArray
- Type: SystemArray
The Array that contains the data to copy. - sourceIndex
- Type: SystemInt64
A 64-bit integer that represents the index in the sourceArray at which copying begins. - destinationArray
- Type: SystemArray
The Array that receives the data. - destinationIndex
- Type: SystemInt64
A 64-bit integer that represents the index in the destinationArray at which storing begins. - length
- Type: SystemInt64
A 64-bit integer that represents the number of elements to copy. The integer must be between zero and MaxValue, inclusive.
Exceptions Exception | Condition |
---|
ArgumentNullException | sourceArray is null.-or-destinationArray is null. |
RankException | sourceArray and destinationArray have different ranks. |
ArrayTypeMismatchException | sourceArray and destinationArray are of incompatible types. |
InvalidCastException | At least one element in sourceArray cannot be cast to the type of destinationArray. |
ArgumentOutOfRangeException | sourceIndex is outside the range of valid indexes for the sourceArray.-or-destinationIndex is outside the range of valid indexes for the destinationArray.-or-length is less than 0 or greater than MaxValue. |
ArgumentException | length is greater than the number of elements from sourceIndex to the end of sourceArray.-or-length is greater than the number of elements from destinationIndex to the end of destinationArray. |
See Also