Enhanced C#
Language of your choice: library documentation
Static Public Member Functions | List of all members
Loyc.Collections.MutableListExtensionMethods.LinqToLists Class Reference

Source file:

Static Public Member Functions

static int Count< T > (this IList< T > list)
 
static T FirstOrDefault< T > (this IList< T > list, T defaultValue=default(T))
 
static T Last< T > (this IList< T > list)
 Gets the last item from the list (at list.Max). More...
 
static T LastOrDefault< T > (this IList< T > list, T defaultValue=default(T))
 Gets the last item from the list (Count - 1), or defaultValue if the list is empty. More...
 
static ListSlice< T > Skip< T > (this IList< T > list, int start)
 Skips the specified number of elements immediately and returns a slice of part of the list that remains, or an empty slice if start is greater than or equal to the list.Count. More...
 
static ListSlice< T > Take< T > (this IList< T > list, int count)
 Returns a slice of the specified number of elements from the beginning of the list, or a slice of the entire list if count is greater than or equal to the list.Count. More...
 
static ListSlice< T > TakeNowWhile< T > (this IList< T > list, Func< T, bool > predicate)
 Returns a slice of the initial elements of the list that meet the provided criteria. The word "now" is added to the name because unlike Enumerable.TakeWhile, this method scans the list immediately. More...
 
static ListSlice< T > SkipNowWhile< T > (this IList< T > list, Func< T, bool > predicate)
 Returns a slice without the initial elements of the list that meet the specified criteria. The word "now" is added to the name because unlike Enumerable.SkipWhile, this method scans the list immediately. More...
 
static SelectCollection< ICollection< T >, T, TResult > Select< T, TResult > (this ICollection< T > list, Func< T, TResult > selector)
 
static SelectList< IList< T >, T, TResult > Select< T, TResult > (this IList< T > list, Func< T, TResult > selector)
 
static T[] ToArray< T > (this ICollection< T > c)
 
static bool SequenceEqual< TSource > (this IList< TSource > first, IList< TSource > second)
 
static T Last< T > (this IListAndListSource< T > list)
 
static T LastOrDefault< T > (this IListAndListSource< T > list, T defaultValue=default(T))
 
static T FirstOrDefault< T > (this IListAndListSource< T > list, T defaultValue=default(T))
 
static SelectList< T[], T, TResult > Select< T, TResult > (this T[] list, Func< T, TResult > selector)
 
static SelectListSource< IListSource< T >, T, TResult > Select< T, TResult > (this IListAndListSource< T > source, Func< T, TResult > selector)
 
static SelectReadOnlyCollection< IReadOnlyCollection< T >, T, TResult > Select< T, TResult > (this ICollectionAndReadOnly< T > list, Func< T, TResult > selector)
 
static SelectList< IList< T >, T, TResult > Select< T, TResult > (this List< T > list, Func< T, TResult > selector)
 
static SelectCollection< ICollection< T >, T, TResult > Select< T, TResult > (this HashSet< T > list, Func< T, TResult > selector)
 
static SelectCollection< ICollection< KeyValuePair< K, V > >, KeyValuePair< K, V >, TResult > Select< K, V, TResult > (this Dictionary< K, V > list, Func< KeyValuePair< K, V >, TResult > selector)
 
static ListSlice< T > TakeNowWhile< T > (this IListAndListSource< T > list, Func< T, bool > predicate)
 
static ListSlice< T > SkipNowWhile< T > (this IListAndListSource< T > list, Func< T, bool > predicate)
 
static bool SequenceEqual< TSource > (this IListAndListSource< TSource > first, IListAndListSource< TSource > second)
 

Member Function Documentation

◆ Last< T >()

static T Loyc.Collections.MutableListExtensionMethods.LinqToLists.Last< T > ( this IList< T >  list)
inlinestatic

Gets the last item from the list (at list.Max).

Exceptions
EmptySequenceExceptionThe list is empty

◆ LastOrDefault< T >()

static T Loyc.Collections.MutableListExtensionMethods.LinqToLists.LastOrDefault< T > ( this IList< T >  list,
defaultValue = default(T) 
)
inlinestatic

Gets the last item from the list (Count - 1), or defaultValue if the list is empty.

◆ Skip< T >()

static ListSlice<T> Loyc.Collections.MutableListExtensionMethods.LinqToLists.Skip< T > ( this IList< T >  list,
int  start 
)
inlinestatic

Skips the specified number of elements immediately and returns a slice of part of the list that remains, or an empty slice if start is greater than or equal to the list.Count.

◆ SkipNowWhile< T >()

static ListSlice<T> Loyc.Collections.MutableListExtensionMethods.LinqToLists.SkipNowWhile< T > ( this IList< T >  list,
Func< T, bool >  predicate 
)
inlinestatic

Returns a slice without the initial elements of the list that meet the specified criteria. The word "now" is added to the name because unlike Enumerable.SkipWhile, this method scans the list immediately.

Example: new[] { 24, 28, 2, 12, 11 }.SkipNowWhile(n => n > 10) returns a slice (not a copy) of the last 2 elements.

◆ Take< T >()

static ListSlice<T> Loyc.Collections.MutableListExtensionMethods.LinqToLists.Take< T > ( this IList< T >  list,
int  count 
)
inlinestatic

Returns a slice of the specified number of elements from the beginning of the list, or a slice of the entire list if count is greater than or equal to the list.Count.

◆ TakeNowWhile< T >()

static ListSlice<T> Loyc.Collections.MutableListExtensionMethods.LinqToLists.TakeNowWhile< T > ( this IList< T >  list,
Func< T, bool >  predicate 
)
inlinestatic

Returns a slice of the initial elements of the list that meet the provided criteria. The word "now" is added to the name because unlike Enumerable.TakeWhile, this method scans the list immediately.

Example: new[] { 13, 16, 19, 2, 11, 12 }.TakeNowWhile(n => n > 10) returns a slice (not a copy) of the first 3 elements.