DotNext by .NET Foundation and Contributors

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

 SpanReader<T>

public struct SpanReader<T>
Represents simple memory reader backed by ReadOnlySpan<T>.
public int ConsumedCount { get; }

Gets the number of consumed elements.

public ReadOnlySpan<T> ConsumedSpan { get; }

Gets the span over consumed elements.

public T& modreq(System.Runtime.InteropServices.InAttribute) Current { get; }

Gets the element at the current position in the underlying memory block.

public int RemainingCount { get; }

Gets the number of unread elements.

public ReadOnlySpan<T> RemainingSpan { get; }

Gets the remaining part of the span.

public ReadOnlySpan<T> Span { get; }

Gets underlying span.

public SpanReader(ReadOnlySpan<T> span)

Initializes a new memory reader.

public SpanReader(ref T reference, int length)

Initializes a new memory reader.

public void Advance(int count)

Advances the position of this reader.

public int Read(Span<T> output)

Copies elements from the underlying span.

public T Read()

Reads single element from the underlying span.

public ReadOnlySpan<T> Read(int count)

Reads the portion of data from the underlying span.

public TResult Read<TResult>(method reader, int count)

public ReadOnlySpan<T> ReadToEnd()

Reads the rest of the memory block.

public void Reset()

Sets reader position to the first element.

public void Rewind(int count)

Moves the reader back the specified number of items.

public bool TryRead(Span<T> output)

Copies elements from the underlying span.

public bool TryRead(int count, out ReadOnlySpan result)

Reads the portion of data from the underlying span.

public bool TryRead(out T result)

Reads single element from the underlying span.

public bool TryRead<TResult>(method reader, int count, out TResult result)