Memory<T>.Slice Memory<T>.Slice Memory<T>.Slice Memory<T>.Slice Method

定义

重载

Slice(Index) Slice(Index) Slice(Index) Slice(Index)
Slice(Int32) Slice(Int32) Slice(Int32) Slice(Int32)

从指定索引处开始的当前内存外形成切片。Forms a slice out of the current memory that begins at a specified index.

Slice(Range) Slice(Range) Slice(Range)
Slice(Int32, Int32) Slice(Int32, Int32) Slice(Int32, Int32) Slice(Int32, Int32)

从指定长度的指定索引处开始,在当前内存外形成切片。Forms a slice out of the current memory starting at a specified index for a specified length.

Slice(Index) Slice(Index) Slice(Index) Slice(Index)

public:
 Memory<T> Slice(Index startIndex);
public Memory<T> Slice (Index startIndex);
member this.Slice : Index -> Memory<'T>
Public Function Slice (startIndex As Index) As Memory(Of T)

参数

startIndex
Index Index Index Index

返回

Slice(Int32) Slice(Int32) Slice(Int32) Slice(Int32)

从指定索引处开始的当前内存外形成切片。Forms a slice out of the current memory that begins at a specified index.

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

参数

start
Int32 Int32 Int32 Int32

开始切片处的索引。The index at which to begin the slice.

返回

包含当前实例的所有元素(从 start 到实例末尾)的对象。An object that contains all elements of the current instance from start to the end of the instance.

异常

Slice(Range) Slice(Range) Slice(Range)

public:
 Memory<T> Slice(Range range);
public Memory<T> Slice (Range range);
member this.Slice : Range -> Memory<'T>

参数

返回

Slice(Int32, Int32) Slice(Int32, Int32) Slice(Int32, Int32) Slice(Int32, Int32)

从指定长度的指定索引处开始,在当前内存外形成切片。Forms a slice out of the current memory starting at a specified index for a specified length.

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

参数

start
Int32 Int32 Int32 Int32

开始切片处的索引。The index at which to begin the slice.

length
Int32 Int32 Int32 Int32

要包括在切片中的元素数。The number of elements to include in the slice.

返回

包含当前实例的 length 元素(从 start 开始)的对象。An object that contains length elements from the current instance starting at start.

异常

start 小于零或大于 Lengthstart is less than zero or greater than Length.

-or-

length 大于 Length - startlength is greater than Length - start

适用于