SequenceReader<T> SequenceReader<T> SequenceReader<T> SequenceReader<T> Struct

定義

提供用來從 ReadOnlySequence<T> 讀取二進位資料和文字資料的方法,並著重於效能以及為最小或零的堆積配置。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 struct SequenceReader<T> where T : struct
type SequenceReader<'T (requires 'T : struct)> = struct
Public Structure SequenceReader(Of T)

類型參數

T

唯讀序列的類型。The type of the read-only sequence.

繼承
SequenceReader<T>SequenceReader<T>SequenceReader<T>SequenceReader<T>

建構函式

SequenceReader<T>(ReadOnlySequence<T>) SequenceReader<T>(ReadOnlySequence<T>) SequenceReader<T>(ReadOnlySequence<T>) SequenceReader<T>(ReadOnlySequence<T>)

在指定的 ReadOnlySequence<T> 上建立 SequenceReader<T>Creates a SequenceReader<T> over a given ReadOnlySequence<T>.

屬性

Consumed Consumed Consumed Consumed

取得讀取器所處理的 T 值總數。Gets the total number of T values processed by the reader.

CurrentSpan CurrentSpan CurrentSpan CurrentSpan

取得 Span<T>,其在 Sequence 中包含目前的區段。Gets a Span<T> that contains the current segment in the Sequence.

CurrentSpanIndex CurrentSpanIndex CurrentSpanIndex CurrentSpanIndex

取得 CurrentSpan 中的索引。Gets the index in the CurrentSpan.

End End End End

取得值,指出 Sequence 是否不再有任何資料。Gets a value that indicates whether there is no more data in the Sequence.

Length Length Length Length

取得讀取器 Sequence 中的項目計數。Gets the count of items in the reader's Sequence.

Position Position Position Position

取得目前在 Sequence 中的位置。Gets the current position in the Sequence.

Remaining Remaining Remaining Remaining

取得讀取器 Sequence 中的剩餘項目。Gets the remaining items in the reader's Sequence.

Sequence Sequence Sequence Sequence

取得讀取器的基礎 ReadOnlySequence<T>Gets the underlying ReadOnlySequence<T> for the reader.

UnreadSpan UnreadSpan UnreadSpan UnreadSpan

取得 CurrentSpan 的未讀取部分。Gets the unread portion of the CurrentSpan.

方法

Advance(Int64) Advance(Int64) Advance(Int64) Advance(Int64)

依指定的項目數將讀取器向前移。Moves the reader ahead a specified number of items.

AdvancePast(T) AdvancePast(T) AdvancePast(T) AdvancePast(T)

前進超過指定的 value 個連續執行個體。Advances past consecutive instances of the given value.

AdvancePastAny(ReadOnlySpan<T>) AdvancePastAny(ReadOnlySpan<T>) AdvancePastAny(ReadOnlySpan<T>) AdvancePastAny(ReadOnlySpan<T>)

跳過任何指定的 values 個連續執行個體。Skips consecutive instances of any of the specified values.

AdvancePastAny(T, T) AdvancePastAny(T, T) AdvancePastAny(T, T) AdvancePastAny(T, T)

前進超過兩個指定值之一的連續執行個體。Advances past consecutive instances of either of two specified values.

AdvancePastAny(T, T, T) AdvancePastAny(T, T, T) AdvancePastAny(T, T, T) AdvancePastAny(T, T, T)

前進超過三個指定值之一的連續執行個體。Advances past consecutive instances of any of three specified values.

AdvancePastAny(T, T, T, T) AdvancePastAny(T, T, T, T) AdvancePastAny(T, T, T, T) AdvancePastAny(T, T, T, T)

前進超過四個指定值之一的連續執行個體。Advances past consecutive instances of any of four specified values.

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

檢查在唯讀範圍中所指定值是否為序列中的下一個。Checks whether the values specified in a read-only span are next in the sequence.

IsNext(T, Boolean) IsNext(T, Boolean) IsNext(T, Boolean) IsNext(T, Boolean)

檢查所指定值是否為序列中的下一個。Checks whether a specified value is next in the sequence.

Rewind(Int64) Rewind(Int64) Rewind(Int64) Rewind(Int64)

依指定的項目數將讀取器向後移。Moves the reader back the specified number of items.

TryAdvanceTo(T, Boolean) TryAdvanceTo(T, Boolean) TryAdvanceTo(T, Boolean) TryAdvanceTo(T, Boolean)

搜尋指定的分隔符號,並選擇性前進超過它 (如果找到)。Searches for a specified delimiter and optionally advances past it if it is found.

TryAdvanceToAny(ReadOnlySpan<T>, Boolean) TryAdvanceToAny(ReadOnlySpan<T>, Boolean) TryAdvanceToAny(ReadOnlySpan<T>, Boolean) 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>) TryCopyTo(Span<T>) TryCopyTo(Span<T>) TryCopyTo(Span<T>)

如果沒有足夠的資料填入,請將資料從目前位置複製到指定的目的地範圍。Copies data from the current position to the given destination span if there is enough data to fill it.

TryPeek(T) TryPeek(T) TryPeek(T) TryPeek(T)

查看下一個值,但不使讀取器前進。Peeks at the next value without advancing the reader.

TryRead(T) TryRead(T) TryRead(T) TryRead(T)

讀取下一個值,並使讀取器前進。Reads the next value and advance the reader.

TryReadTo(ReadOnlySequence<T>, ReadOnlySpan<T>, Boolean) TryReadTo(ReadOnlySequence<T>, ReadOnlySpan<T>, Boolean) TryReadTo(ReadOnlySequence<T>, ReadOnlySpan<T>, Boolean) 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) TryReadTo(ReadOnlySequence<T>, T, Boolean) TryReadTo(ReadOnlySequence<T>, T, Boolean) TryReadTo(ReadOnlySequence<T>, T, Boolean)

嘗試讀取所有項目,最多為指定的 delimiterTries to read everything up to the given delimiter.

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

嘗試讀取所有項目,最多為指定的 delimiterTries to read everything up to the given delimiter.

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

嘗試讀取所有項目,最多為指定的 delimiter,忽略前有 delimiterEscape 的分隔符號。Tries to read everything up to the given delimiter, ignoring delimiters that are preceded by delimiterEscape.

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

嘗試讀取所有項目,最多為指定的 delimiter,忽略前有 delimiterEscape 的分隔符號。Tries to read everything up to the given delimiter, ignoring delimiters that are preceded by delimiterEscape.

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

嘗試讀取所有項目,最多為任何指定的 delimitersTries to read everything up to any of the specified delimiters.

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

嘗試讀取所有項目,最多為任何指定的 delimitersTries to read everything up to any of the specified delimiters.

適用於