SequenceMarshal.TryGetReadOnlySequenceSegment<T> Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Attempts to retrieve a read-only sequence segment from the specified read-only sequence.

C#
public static bool TryGetReadOnlySequenceSegment<T>(System.Buffers.ReadOnlySequence<T> sequence, out System.Buffers.ReadOnlySequenceSegment<T>? startSegment, out int startIndex, out System.Buffers.ReadOnlySequenceSegment<T>? endSegment, out int endIndex);
C#
public static bool TryGetReadOnlySequenceSegment<T>(System.Buffers.ReadOnlySequence<T> sequence, out System.Buffers.ReadOnlySequenceSegment<T> startSegment, out int startIndex, out System.Buffers.ReadOnlySequenceSegment<T> endSegment, out int endIndex);

Type Parameters

T

The type of the read-only sequence.

Parameters

sequence
ReadOnlySequence<T>

The read-only sequence from which the read-only sequence segment will be retrieved.

startSegment
ReadOnlySequenceSegment<T>

The beginning read-only sequence segment.

startIndex
Int32

The initial position.

endSegment
ReadOnlySequenceSegment<T>

The ending read-only sequence segment.

endIndex
Int32

The final position.

Returns

true if the read-only sequence segment can be retrieved; otherwise, false.

Applies to

Tuote Versiot
.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