Click or drag to resize

ArrayExtensionsCombineT(T, Int32, Int32, T, Int32, Int32) Method

Combines specified portions of arrays together into a single array.

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public static T[] Combine<T>(
	this T[] source,
	int sourceOffset,
	int sourceCount,
	T[] other,
	int otherOffset,
	int otherCount
)
View Source

Parameters

source  T
Source array.
sourceOffset  Int32
Offset into source array to begin copy.
sourceCount  Int32
Number of bytes to copy from source array.
other  T
Other array to combine to source array.
otherOffset  Int32
Offset into other array to begin copy.
otherCount  Int32
Number of bytes to copy from other array.

Type Parameters

T

Return Value

T
Combined specified portions of both arrays.

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
ArgumentOutOfRangeExceptionsourceOffset or otherOffset is outside the range of valid indexes for the associated array -or- sourceCount or otherCount is less than 0 -or- sourceOffset or otherOffset, and sourceCount or otherCount do not specify a valid section in the associated array.
Remarks

Only use this function if you need a copy of the combined arrays, it will be optimal to use the Linq function ConcatTSource(IEnumerableTSource, IEnumerableTSource) if you simply need to iterate over the combined arrays.

This function can easily throw an out of memory exception if there is not enough contiguous memory to create an array sized with the combined lengths.

See Also