METHOD
SequenceReader<T>.TryReadTo
Searches for the specified delimiter, returning the preceding sequence and advancing the cursor on success. Explicitly select a sequence result for segmented input. A returned view shares the original buffer lifetime.
Formal Syntax & Structure
csharp syntaxcsharp
reader.TryReadTo(out ReadOnlySequence<byte> frame, delimiter, advancePastDelimiter: true)Working Example
Example Snippetcsharp
using System;using System.IO;using System.Collections.Generic;using System.Buffers;using System.Buffers.Binary;using System.Runtime.CompilerServices;using System.Threading;var r=new SequenceReader<byte>(new ReadOnlySequence<byte>(new byte[]{65,10})); if(r.TryReadTo(out ReadOnlySequence<byte> frame,(byte)10)) Console.WriteLine(frame.Length); // 1