Muokkaa

Jaa


ReadOnlySequence<T> Struct

Definition

Represents a sequence that can read a sequential series of T.

generic <typename T>
public value class ReadOnlySequence
public readonly struct ReadOnlySequence<T>
type ReadOnlySequence<'T> = struct
Public Structure ReadOnlySequence(Of T)

Type Parameters

T

The type of the elements in the read-only sequence.

Inheritance
ReadOnlySequence<T>

Constructors

ReadOnlySequence<T>(ReadOnlyMemory<T>)

Creates an instance of ReadOnlySequence<T> from a ReadOnlyMemory<T>.

ReadOnlySequence<T>(ReadOnlySequenceSegment<T>, Int32, ReadOnlySequenceSegment<T>, Int32)

Creates an instance of a ReadOnlySequence<T> from a linked memory list represented by start and end segments and the corresponding indexes in them.

ReadOnlySequence<T>(T[], Int32, Int32)

Creates an instance of a ReadOnlySequence<T> from a section of an array.

ReadOnlySequence<T>(T[])

Creates an instance of ReadOnlySequence<T> from the array.

Fields

Empty

Returns an empty ReadOnlySequence<T>.

Properties

End

Gets the position at the end of the ReadOnlySequence<T>.

First

Gets the ReadOnlyMemory<T> from the first segment.

FirstSpan

Gets the ReadOnlySpan<T> from the first segment.

IsEmpty

Gets a value that indicates whether the ReadOnlySequence<T> is empty.

IsSingleSegment

Gets a value that indicates whether the ReadOnlySequence<T> contains a single ReadOnlyMemory<T> segment.

Length

Gets the length of the ReadOnlySequence<T>.

Start

Gets the position to the start of the ReadOnlySequence<T>.

Methods

GetEnumerator()

Returns an enumerator over the ReadOnlySequence<T>.

GetOffset(SequencePosition)

Returns the offset of a position within this sequence from the start.

GetPosition(Int64, SequencePosition)

Returns a new SequencePosition starting at the specified offset from the origin position.

GetPosition(Int64)

Returns a new SequencePosition at an offset from the start of the sequence.

Slice(Int32, Int32)

Forms a slice out of the current ReadOnlySequence<T>, beginning at start, with length items.

Slice(Int32, SequencePosition)

Forms a slice out of the current ReadOnlySequence<T>, beginning at start and ending at end (exclusive).

Slice(Int64, Int64)

Forms a slice out of the given ReadOnlySequence<T>, beginning at start, with length items.

Slice(Int64, SequencePosition)

Forms a slice out of the current ReadOnlySequence<T>, beginning at start and ending at end (exclusive).

Slice(Int64)

Forms a slice out of the current ReadOnlySequence<T>, beginning at a specified index and continuing to the end of the read-only sequence.

Slice(SequencePosition, Int32)

Forms a slice out of the current ReadOnlySequence<T>, beginning at start, with length items.

Slice(SequencePosition, Int64)

Forms a slice out of the current ReadOnlySequence<T>, beginning at start, with length items.

Slice(SequencePosition, SequencePosition)

Forms a slice out of the current ReadOnlySequence<T>, beginning at start and ending at end (exclusive).

Slice(SequencePosition)

Forms a slice out of the current ReadOnlySequence<T>, beginning at a specified sequence position and continuing to the end of the read-only sequence.

ToString()

Returns a string that represents the current sequence.

TryGet(SequencePosition, ReadOnlyMemory<T>, Boolean)

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

Extension Methods

CopyTo<T>(ReadOnlySequence<T>, Span<T>)

Copies the ReadOnlySequence<T> to the specified Span<T>.

PositionOf<T>(ReadOnlySequence<T>, T)

Returns the position of the first occurrence of item in the ReadOnlySequence<T>.

ToArray<T>(ReadOnlySequence<T>)

Converts the ReadOnlySequence<T> to an array.

Applies to