Click or drag to resize

ArrayExtensions.BlockCopy<T> Method

Returns a copy of the specified portion of the array array.

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.239-beta+5928cebde0dd955df84e791f5ea67acbd192773e
Syntax
public static T[] BlockCopy<T>(
	this T[] array,
	int startIndex,
	int length
)
View Source

Parameters

array  T[]
Source array.
startIndex  Int32
Offset into array array.
length  Int32
Length of array array to copy at startIndex offset.

Type Parameters

T

Return Value

T[]
A array of data copied from the specified portion of the source array.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type T[]. 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
ExceptionCondition
ArgumentOutOfRangeExceptionstartIndex is outside the range of valid indexes for the source array -or- length is less than 0.
Remarks

Returned array will be extended as needed to make it the specified length, but it will never be less than the source array length - startIndex.

If an existing array of primitives is already available, using the BlockCopy(Array, Int32, Array, Int32, Int32) directly instead of this extension method may be optimal since this method always allocates a new return array. Unlike BlockCopy(Array, Int32, Array, Int32, Int32), however, this function also works with non-primitive types.

See Also