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.

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

View source

Type Parameters

Name Description
T The type of elements in the memory.

Parameters

Name Type Description
memory ReadOnlyMemory<T> The memory to wrap.
startIndex Int32 The zero-based index to start from.

Returns

ReadOnlySequence<T>

A ReadOnlySequence<T> wrapping the memory.