Skip to content

M_CodeJam_Collections_ArrayExtensions_Copy_1

Andrew Koryavchenko edited this page Jun 17, 2018 · 7 revisions

ArrayExtensions.Copy Method (Array, Array, Int64)

Copies a range of elements from an Array starting at the first element and pastes them into another Array starting at the first element. The length is specified as a 64-bit integer.

Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static void Copy(
	this Array sourceArray,
	Array destinationArray,
	long length
)

VB

<ExtensionAttribute>
Public Shared Sub Copy ( 
	sourceArray As Array,
	destinationArray As Array,
	length As Long
)

F#

[<ExtensionAttribute>]
static member Copy : 
        sourceArray : Array * 
        destinationArray : Array * 
        length : int64 -> unit 

Parameters

 

sourceArray
Type: System.Array
The Array that contains the data to copy.
destinationArray
Type: System.Array
The Array that receives the data.
length
Type: System.Int64
A 64-bit integer that represents the number of elements to copy. The integer must be between zero and MaxValue, inclusive.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Array. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

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 length is less than 0 or greater than MaxValue.
ArgumentException length is greater than the number of elements in sourceArray.-or-length is greater than the number of elements in destinationArray.

See Also

Reference

ArrayExtensions Class
Copy Overload
CodeJam.Collections Namespace

Clone this wiki locally