Bewerken

Delen via


List<T>.Slice(Int32, Int32) Method

Definition

Creates a shallow copy of a range of elements in the source 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)

Parameters

start
Int32

The zero-based List<T> index at which the range starts.

length
Int32

The length of the range.

Returns

A shallow copy of a range of elements in the source List<T>.

Exceptions

start is less than 0.

-or-

length is less than 0.

start and length do not denote a valid range of elements in the List<T>.

Applies to