Enumerable.TakeLast<TSource>(IEnumerable<TSource>, Int32) Metod

Definition

Returnerar en ny uppräkningsbar samling som innehåller de sista count elementen från source.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::IEnumerable<TSource> ^ TakeLast(System::Collections::Generic::IEnumerable<TSource> ^ source, int count);
public static System.Collections.Generic.IEnumerable<TSource> TakeLast<TSource>(this System.Collections.Generic.IEnumerable<TSource> source, int count);
static member TakeLast : seq<'Source> * int -> seq<'Source>
<Extension()>
Public Function TakeLast(Of TSource) (source As IEnumerable(Of TSource), count As Integer) As IEnumerable(Of TSource)

Typparametrar

TSource

Typ av element i den uppräkningsbara samlingen.

Parametrar

source
IEnumerable<TSource>

En uppräkningsbar samlingsinstans.

count
Int32

Antalet element som ska hämtas från slutet av samlingen.

Returer

IEnumerable<TSource>

En ny uppräkningsbar samling som innehåller de sista count elementen från source.

Undantag

source är null.

Kommentarer

Om count inte är ett positivt tal returnerar den här metoden en tom uppräkningsbar samling.

Gäller för