DotNext by Roman Sakno

<PackageReference Include="DotNext" Version="2.8.0" />

 ChunkSequence

public static class ChunkSequence
Represents extension methods for ChunkSequence<T>.
public static ReadOnlySequence<T> Concat<T>(this Memory<T> first, Memory<T> second)

Converts two memory blocks to ReadOnlySequence<T> data type.

public static ValueTask CopyToAsync(this ChunkSequence<byte> sequence, Stream output, CancellationToken token = default)

Copies chunks of bytes into the stream.

public static ValueTask CopyToAsync(this ChunkSequence<char> sequence, TextWriter output, CancellationToken token = default)

Copies chunks of bytes into the text writer.

public static ReadOnlySequence<T> ToReadOnlySequence<T>(this IEnumerable<Memory<T>> chunks)

Converts the sequence of memory blocks to ReadOnlySequence<T> data type.