List<T>.Slice(Int32, Int32) 方法

定義

為來源 List<T> 中的項目範圍建立淺層複本。

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

參數

start
Int32

範圍起始處之以零為起始的 List<T> 索引。

length
Int32

範圍的長度。

傳回

來源 List<T> 中項目範圍的淺層複本。

例外狀況

start 小於 0。

-或-

length 小於 0。

startlength 不代表 List<T> 中項目的有效範圍。

適用於