ReadOnlyMemory<T>.Slice Method

Definition

Overloads

Slice(Int32)

Forms a slice out of the given memory region, beginning at a specified poisition and continuing to its end.

Slice(Int32, Int32)

Forms a slice out of the given memory region starting at start position for length elements.

Slice(Int32)

Forms a slice out of the given memory region, beginning at a specified poisition and continuing to its end.

public:
 ReadOnlyMemory<T> Slice(int start);
public ReadOnlyMemory<T> Slice (int start);
member this.Slice : int -> ReadOnlyMemory<'T>
Public Function Slice (start As Integer) As ReadOnlyMemory(Of T)

Parameters

start
Int32

The index at which to begin this slice.

Returns

A read-only memory region representing the desired slice.

Exceptions

start is less than 0 or greater than Length.

Slice(Int32, Int32)

Forms a slice out of the given memory region starting at start position for length elements.

public:
 ReadOnlyMemory<T> Slice(int start, int length);
public ReadOnlyMemory<T> Slice (int start, int length);
member this.Slice : int * int -> ReadOnlyMemory<'T>
Public Function Slice (start As Integer, length As Integer) As ReadOnlyMemory(Of T)

Parameters

start
Int32

The index at which to begin this slice.

length
Int32

The desired length for the slice.

Returns

A read-only memory region representing the desired slice.

Exceptions

start, length, or start + length are outside the range of the current instance.

Applies to