MemoryExtensionsSplitAtT(ReadOnlyMemoryT, Int32, Int32) Method

Splits a ReadOnlyMemoryT 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 (ReadOnlyMemory<T> , ReadOnlyMemory<T> ) SplitAt<T>(
	this ReadOnlyMemory<T> span,
	int index,
	int skip = 0
)

Parameters

span  ReadOnlyMemoryT
The memory region 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 ReadOnlyMemoryT.

Return Value

ValueTupleReadOnlyMemoryT, ReadOnlyMemoryT
A tuple 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 ReadOnlyMemoryT. 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