ArrayExtensionsBlockCopyT Method

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

Definition

Namespace: Gemstone.ArrayExtensions
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.128 -- Release Build+d050cfc5563c89a1188cc3c6b2d417530856f490
public static T[] BlockCopy<T>(
	this T[] array,
	int startIndex,
	int length
)

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
Type of array.

Return Value

T
An 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).

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.

Exceptions

ArgumentOutOfRangeExceptionstartIndex is outside the range of valid indexes for the source array -or- length is less than 0.

See Also