Skip to content

ReadOnlyMemoryExtensions.CreateWrappedSequence Method ​

Definition ​

Creates a ReadOnlySequence<T> that wraps a ReadOnlyMemory<T>, starting at the specified index. The sequence contains two segments covering the same underlying memory, allowing sequential reading that wraps around the starting position.

c#
public static ReadOnlySequence<T> CreateWrappedSequence<T>(this ReadOnlyMemory<T> memory, int startIndex = 0);

View source

Type Parameters ​

NameDescription
TThe type of elements in the memory.

Parameters ​

NameTypeDescription
memoryReadOnlyMemory<T>The memory to wrap.
startIndexInt32The zero-based index to start from.

Returns ​

ReadOnlySequence<T>

A ReadOnlySequence<T> wrapping the memory.