|
ArrayExtensionsBlockCopyT Method
|
Returns a copy of the specified portion of the array array.
Namespace: GSFAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.205-beta+5ef4169f3b1079d8b163dd363614f656bd140924
Syntax public static T[] BlockCopy<T>(
this T[] array,
int startIndex,
int length
)
public:
[ExtensionAttribute]
generic<typename T>
static array<T>^ BlockCopy(
array<T>^ array,
int startIndex,
int length
)
JavaScript does not support generic types or methods.
View SourceParameters
- 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
TA 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 Exception | Condition |
---|
ArgumentOutOfRangeException | startIndex 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