ReadOnlySpan<T>.Slice 方法

定义

重载

Slice(Int32)

从指定索引处开始的当前只读范围外形成切片。

Slice(Int32, Int32)

从指定长度的指定索引处开始的当前只读范围外形成切片。

Slice(Int32)

Source:
ReadOnlySpan.cs
Source:
ReadOnlySpan.cs
Source:
ReadOnlySpan.cs

从指定索引处开始的当前只读范围外形成切片。

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

开始切片处的索引。

返回

由当前范围(从 start 到范围末尾)的所有元素组成的范围。

例外

start 大于只读范围中的项数。

适用于

Slice(Int32, Int32)

Source:
ReadOnlySpan.cs
Source:
ReadOnlySpan.cs
Source:
ReadOnlySpan.cs

从指定长度的指定索引处开始的当前只读范围外形成切片。

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

开始切片处的索引。

length
Int32

切片所需的长度。

返回

由当前范围(从 start 开始)中 length 元素组成的只读范围。

例外

start 小于零或大于 Length

适用于