DotNext by .NET Foundation and Contributors

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

 ReadOnlySequencePartitioner

public static class ReadOnlySequencePartitioner
Represents factory of Partitioner<T> objects for ReadOnlySequence<T>.
using System; using System.Buffers; using System.Collections.Concurrent; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace DotNext.Buffers { public static class ReadOnlySequencePartitioner { [System.Runtime.CompilerServices.NullableContext(1)] public static OrderablePartitioner<T> CreatePartitioner<[System.Runtime.CompilerServices.Nullable(2)] T>([In] [IsReadOnly] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] ref ReadOnlySequence<T> sequence, bool splitOnSegments = false) { if (!sequence.IsEmpty) return new ReadOnlySequencePartitioner<T>(ref sequence, splitOnSegments); return Partitioner.Create(Array.Empty<T>(), splitOnSegments); } } }