แก้ไข

แชร์ผ่าน


SequenceReader<T> Struct

Definition

Provides methods for reading binary and text data out of a ReadOnlySequence<T> with a focus on performance and minimal or zero heap allocations.

generic <typename T>
 where T : value classpublic value class SequenceReader
public ref struct SequenceReader<T> where T : struct
type SequenceReader<'T (requires 'T : struct)> = struct
Public Structure SequenceReader(Of T)

Type Parameters

T

The type of the read-only sequence.

Inheritance
SequenceReader<T>

Constructors

SequenceReader<T>(ReadOnlySequence<T>)

Creates a SequenceReader<T> over a given ReadOnlySequence<T>.

Properties

Consumed

Gets the total number of T values processed by the reader.

CurrentSpan

Gets a Span<T> that contains the current segment in the Sequence.

CurrentSpanIndex

Gets the index in the CurrentSpan.

End

Gets a value that indicates whether there is no more data in the Sequence.

Length

Gets the count of items in the reader's Sequence.

Position

Gets the current position in the Sequence.

Remaining

Gets the remaining items in the reader's Sequence.

Sequence

Gets the underlying ReadOnlySequence<T> for the reader.

UnreadSequence

Gets the unread portion of the Sequence.

UnreadSpan

Gets the unread portion of the CurrentSpan.

Methods

Advance(Int64)

Moves the reader ahead a specified number of items.

AdvancePast(T)

Advances past consecutive instances of the given value.

AdvancePastAny(ReadOnlySpan<T>)

Skips consecutive instances of any of the specified values.

AdvancePastAny(T, T, T, T)

Advances past consecutive instances of any of four specified values.

AdvancePastAny(T, T, T)

Advances past consecutive instances of any of three specified values.

AdvancePastAny(T, T)

Advances past consecutive instances of either of two specified values.

AdvanceToEnd()

Moves the reader to the end of the sequence.

IsNext(ReadOnlySpan<T>, Boolean)

Checks whether the values specified in a read-only span are next in the sequence.

IsNext(T, Boolean)

Checks whether a specified value is next in the sequence.

Rewind(Int64)

Moves the reader back the specified number of items.

TryAdvanceTo(T, Boolean)

Searches for a specified delimiter and optionally advances past it if it is found.

TryAdvanceToAny(ReadOnlySpan<T>, Boolean)

Searches for any of a number of specified delimiters and optionally advances past the first one to be found.

TryCopyTo(Span<T>)

Copies data from the current position to the given destination span if there is enough data to fill it.

TryPeek(Int64, T)

Peeks at the next value at the specified offset without advancing the reader.

TryPeek(T)

Peeks at the next value without advancing the reader.

TryRead(T)

Reads the next value and advance the reader.

TryReadExact(Int32, ReadOnlySequence<T>)

Attempts to read exactly count values from the current sequence.

TryReadTo(ReadOnlySequence<T>, ReadOnlySpan<T>, Boolean)

Tries to read data until the entire delimiter specified as a read-only span matches.

TryReadTo(ReadOnlySequence<T>, T, Boolean)

Tries to read everything up to the given delimiter.

TryReadTo(ReadOnlySequence<T>, T, T, Boolean)

Tries to read everything up to the given delimiter, ignoring delimiters that are preceded by delimiterEscape.

TryReadTo(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean)

Try to read everything up to the given delimiter.

TryReadTo(ReadOnlySpan<T>, T, Boolean)

Tries to read everything up to the given delimiter.

TryReadTo(ReadOnlySpan<T>, T, T, Boolean)

Tries to read everything up to the given delimiter, ignoring delimiters that are preceded by delimiterEscape.

TryReadToAny(ReadOnlySequence<T>, ReadOnlySpan<T>, Boolean)

Tries to read everything up to any of the specified delimiters.

TryReadToAny(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean)

Tries to read everything up to any of the specified delimiters.

Applies to