SequenceMarshal.TryGetReadOnlySequenceSegment<T> Method

Definition

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

Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1