ReadOnlySequence<T> Constructors

Definition

Overloads

ReadOnlySequence<T>(ReadOnlyMemory<T>)

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

ReadOnlySequence<T>(T[])

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

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

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

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>(ReadOnlyMemory<T>)

Source:
ReadOnlySequence.cs
Source:
ReadOnlySequence.cs
Source:
ReadOnlySequence.cs

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

public:
 ReadOnlySequence(ReadOnlyMemory<T> memory);
public ReadOnlySequence (ReadOnlyMemory<T> memory);
new System.Buffers.ReadOnlySequence<'T> : ReadOnlyMemory<'T> -> System.Buffers.ReadOnlySequence<'T>
Public Sub New (memory As ReadOnlyMemory(Of T))

Parameters

memory
ReadOnlyMemory<T>

A read-only block of memory of elements of type T.

Remarks

The consumer is expected to manage the lifetime of memory until ReadOnlySequence<T> is not used anymore.

Applies to

ReadOnlySequence<T>(T[])

Source:
ReadOnlySequence.cs
Source:
ReadOnlySequence.cs
Source:
ReadOnlySequence.cs

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

public:
 ReadOnlySequence(cli::array <T> ^ array);
public ReadOnlySequence (T[] array);
new System.Buffers.ReadOnlySequence<'T> : 'T[] -> System.Buffers.ReadOnlySequence<'T>
Public Sub New (array As T())

Parameters

array
T[]

The array from which to create a read-only sequence.

Applies to

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

Source:
ReadOnlySequence.cs
Source:
ReadOnlySequence.cs
Source:
ReadOnlySequence.cs

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

public:
 ReadOnlySequence(cli::array <T> ^ array, int start, int length);
public ReadOnlySequence (T[] array, int start, int length);
new System.Buffers.ReadOnlySequence<'T> : 'T[] * int * int -> System.Buffers.ReadOnlySequence<'T>
Public Sub New (array As T(), start As Integer, length As Integer)

Parameters

array
T[]

The array from which to create the read-only sequence.

start
Int32

The zero-based index of the first element in the array to include in the read-only sequence.

length
Int32

The number of elements to include in the read-only sequence.

Applies to

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

Source:
ReadOnlySequence.cs
Source:
ReadOnlySequence.cs
Source:
ReadOnlySequence.cs

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

public:
 ReadOnlySequence(System::Buffers::ReadOnlySequenceSegment<T> ^ startSegment, int startIndex, System::Buffers::ReadOnlySequenceSegment<T> ^ endSegment, int endIndex);
public ReadOnlySequence (System.Buffers.ReadOnlySequenceSegment<T> startSegment, int startIndex, System.Buffers.ReadOnlySequenceSegment<T> endSegment, int endIndex);
new System.Buffers.ReadOnlySequence<'T> : System.Buffers.ReadOnlySequenceSegment<'T> * int * System.Buffers.ReadOnlySequenceSegment<'T> * int -> System.Buffers.ReadOnlySequence<'T>
Public Sub New (startSegment As ReadOnlySequenceSegment(Of T), startIndex As Integer, endSegment As ReadOnlySequenceSegment(Of T), endIndex As Integer)

Parameters

startSegment
ReadOnlySequenceSegment<T>

The initial node of the linked memory list.

startIndex
Int32

The position to the start of the sequence inside startSegment.

endSegment
ReadOnlySequenceSegment<T>

The final node of the linked memory list.

endIndex
Int32

The position to the end of the sequence inside endSegment.

Exceptions

startSegment or endSegment is null.

The running index of startSegment is greater than the running index of endSegment, even though startSegment is different to endSegment.

-or-

startSegment is equal to endSegment but endIndex is smaller than startIndex.

-or-

startIndex is greater than the length of the underlying memory block of startSegment.

Applies to