Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: IEnumerable<T> SkipLast<T>(this IEnumerable<T>, int, bool)

Declaration

public static IEnumerable<T> SkipLast<T>(
    this IEnumerable<T> source,
    int count,
    bool throwIfNotEnough = false
)

Summary

Enumerates the items of this collection, skipping the last count items. Note that the memory usage of this method is proportional to count, but the source collection is only enumerated once, and in a lazy fashion. Also, enumerating the first item will take longer than enumerating subsequent items.

Generic type parameters

TThis type parameter is not documented.

Parameters

this IEnumerable<T>source Source collection.
intcount Number of items to skip from the end of the collection.
boolthrowIfNotEnough If true, the enumerator throws at the end of the enumeration if the source collection contained fewer than count elements.