Skip to content

OnixLabs.Core.ReadOnlySequenceExtensions

Matthew Layton edited this page Nov 15, 2026 · 2 revisions

ReadOnlySequenceExtensions Class

Extension methods for ReadOnlySequence<T> instances.

Namespace OnixLabs.Core
Assembly OnixLabs.Core.dll (NuGet)
Inheritance object → ReadOnlySequenceExtensions

Definition

[EditorBrowsable(EditorBrowsableState.Never)]
public static class ReadOnlySequenceExtensions

Note This class is decorated with [EditorBrowsable(EditorBrowsableState.Never)], which keeps the container class itself out of IntelliSense lists while its extension methods remain fully usable on the receiver types. Bring the methods into scope with using OnixLabs.Core;.

Remarks

ReadOnlySequenceExtensions provides a convenient materialization helper for ReadOnlySequence<T>. When the sequence is a single contiguous segment the array is created directly from that segment's span; for multi-segment sequences a new array is allocated and the full sequence is copied into it.

Methods

Method Returns Description
CopyTo<T>(out T[]) void Copies the current sequence to a new T array.

CopyTo<T>(out T[])

public void CopyTo<T>(out T[] array)

Copies the current ReadOnlySequence<T> to the specified T array. When the sequence is a single segment, the array is materialized directly from that segment's span; otherwise a new array of Length elements is allocated and the multi-segment sequence is copied into it.

Parameter Type Description
array out T[] The T array to copy into. Assigned by the method.
ReadOnlySequence<byte> sequence = new(buffer);
sequence.CopyTo(out byte[] bytes);

See Also

ONIXLabs .NET Library


Clone this wiki locally