ReadOnlySpan<T>.Slice 方法

定義

多載

Slice(Int32)

從起始於指定索引的目前唯讀範圍形成配量。

Slice(Int32, Int32)

從起始於指定索引之指定長度的目前唯讀範圍形成配量。

Slice(Int32)

從起始於指定索引的目前唯讀範圍形成配量。

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

要開始配量的索引。

傳回

ReadOnlySpan<T>

由從 start 到範圍結尾的目前範圍之所有項目組成的範圍。

例外狀況

start 大於唯讀範圍中的項目數。

適用於

Slice(Int32, Int32)

從起始於指定索引之指定長度的目前唯讀範圍形成配量。

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

配量所需的長度。

傳回

ReadOnlySpan<T>

由起始於 start 目前唯讀範圍之 length 元素組成的範圍。

例外狀況

start 小於零或大於 Length

適用於