MemoryExtensionsSplitAtT(ReadOnlySpanT, Int32, Int32) Method

Splits a ReadOnlySpanT into two parts at the specified index, optionally skipping the specified number of elements.

Definition

Namespace: Ookii.Common
Assembly: Ookii.Common (in Ookii.Common.dll) Version: 1.0.0+7c2900b8a16cd8ae46bdd79d8f105034712c5fa3
C#
public static ReadOnlySpanPair<T, T> SplitAt<T>(
	this ReadOnlySpan<T> span,
	int index,
	int skip = 0
)

Parameters

span  ReadOnlySpanT
The span to split.
index  Int32
The index to split at.
skip  Int32  (Optional)
The number of elements to skip at the split point.

Type Parameters

T
The type of the items in the ReadOnlySpanT.

Return Value

ReadOnlySpanPairT, T
A pair containing the parts before and after the split point.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpanT. 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

ArgumentOutOfRangeExceptionindex or index + skip is less than 0 or greater than the length of span.

See Also