Created
January 26, 2020 12:45
-
-
Save davidfowl/ac86c9b8305026fca067641f7502060c to your computer and use it in GitHub Desktop.
Found while bedrocking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Buffers; | |
namespace ConsoleApp91 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var segment = new Segment(new byte[] { 1, 2, 3 }); | |
var segment2 = new Segment(new byte[] { 4, 5, 6 }); | |
segment.NextSegment = segment2; | |
var reader = new SequenceReader<byte>(new ReadOnlySequence<byte>(segment, 0, segment, 1)); | |
reader.IsNext(new byte[] { 1, 2 }); | |
} | |
} | |
public class Segment : ReadOnlySequenceSegment<byte> | |
{ | |
public Segment(byte[] data) => Memory = data; | |
public Segment NextSegment { get => (Segment)Next; set => Next = value; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment