ReadOnlySequence<T>.TryGet Method

Definition

Tries to retrieve the next segment after position and returns a value that indicates whether the operation succeeded.

C#
public bool TryGet(ref SequencePosition position, out ReadOnlyMemory<T> memory, bool advance = true);

Parameters

position
SequencePosition

The current sequence position.

memory
ReadOnlyMemory<T>

A read-only memory span that contains the next segment after position.

advance
Boolean

true if position should advance to the beginning of the next segment; otherwise, false.

Returns

Returns true if the method returned the next segment, or false if the end of the read-only sequence was reached.

Applies to

Produk Versi
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1