System::Buffers::ReadOnlySequence class

ReadOnlySequence class

Represents a sequence of elements that can be backed either by a single contiguous memory block or by a linked list of contiguous memory segments.

template<typename T>class ReadOnlySequence : public System::Details::BoxableObjectBase
ParameterDescription
TThe type of elements in the sequence.

Methods

MethodDescription
Equals(const ReadOnlySequence&) constDetermines whether the current sequence references the same range as the specified sequence.
static get_Empty()Gets the default (empty) ReadOnlySequence instance.
get_End() constGets the position one past the last element in the sequence.
get_First() constGets the first memory block of the sequence.
get_FirstSpan() constGets the first memory block of the sequence as a read-only span.
get_IsEmpty() constDetermines whether the sequence is empty.
get_IsSingleSegment() constDetermines whether the sequence consists of a single contiguous memory block.
get_Length() constGets the number of elements in the sequence.
get_Start() constGets the position of the first element in the sequence.
GetHashCode() constReturns a hash code for the current sequence.
GetPosition(int64_t) constGets the position at the specified zero-based offset from the start of the sequence.
GetPosition(int64_t, const SequencePosition&) constGets the position at the specified zero-based offset from the given origin position.
operator!=(const ReadOnlySequence&) constDetermines whether the current sequence references a different range than the specified sequence.
operator==(const ReadOnlySequence&) constDetermines whether the current sequence references the same range as the specified sequence.
ReadOnlySequence()Constructs an empty ReadOnlySequence.
ReadOnlySequence(const ReadOnlyMemory<T>&)Constructs a single-segment sequence that wraps the specified contiguous memory.
ReadOnlySequence(const SequencePosition&, const SequencePosition&)Constructs a multi-segment sequence from a range defined by a start and end position.
ReadOnlySequence(const SharedPtr<ReadOnlySequenceSegment<T>>&, int32_t, const SharedPtr<ReadOnlySequenceSegment<T>>&, int32_t)Constructs a multi-segment sequence from a linked list of segments.
Slice(int64_t) constCreates a slice of the sequence starting at the given offset.
Slice(int64_t, int64_t) constCreates a slice of the sequence defined by a start and length.
Slice(const SequencePosition&, const SequencePosition&) constCreates a slice of the sequence defined by a start and end position.
TryGet(SequencePosition&, ReadOnlyMemory<T>&, bool) constRetrieves the memory block that contains the given position.

Fields

FieldDescription
static EmptyThe default (empty) ReadOnlySequence instance.

Typedefs

TypedefDescription
value_typeThe element type.

See Also