ReadOnlySpan<T>.Slice ReadOnlySpan<T>.Slice ReadOnlySpan<T>.Slice ReadOnlySpan<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 read-only span 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 read-only span starting at a specified index for a specified length.

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

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

参数

startIndex
Index Index Index Index

返回

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

从指定索引处开始的当前只读范围外形成切片。Forms a slice out of the current read-only span that begins at a specified index.

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

参数

start
Int32 Int32 Int32 Int32

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

返回

由当前范围(从 start 到范围末尾)的所有元素组成的范围。A span that consists of all elements of the current span from start to the end of the span.

异常

start 大于只读范围中的项数。start is greater than the number of items in the read-only span.

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

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

参数

返回

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

从指定长度的指定索引处开始的当前只读范围外形成切片。Forms a slice out of the current read-only span starting at a specified index for a specified length.

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

参数

start
Int32 Int32 Int32 Int32

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

length
Int32 Int32 Int32 Int32

切片所需的长度。The desired length for the slice.

返回

由当前范围(从 start 开始)中 length 元素组成的只读范围。A read-only span that consists of length elements from the current span starting at start.

异常

适用于