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

This class enhances LINQ-to-Objects with extension methods that preserve the interface (e.g. Take(List<int>) returns IList<int>) and/or have higher performance than the ones in System.Linq.Enumerable. More...


Source file:

Remarks

This class enhances LINQ-to-Objects with extension methods that preserve the interface (e.g. Take(List<int>) returns IList<int>) and/or have higher performance than the ones in System.Linq.Enumerable.

For example, the Enumerable.Last(IEnumerable<T>) extension method scans the entire list before returning the last item, while Last(IReadOnlyList<T>) and Last(IList<T>) simply return the last item directly.

Static Public Member Functions

static int Count< T > (this IList< T > list)
 
static int Count< T > (this IReadOnlyCollection< T > list)
 
static int Count< T > (this INegListSource< T > list)
 
static T FirstOrDefault< T > (this IList< T > list, T defaultValue=default(T))
 
static T FirstOrDefault< T > (this IListAndListSource< T > list, T defaultValue=default(T))
 
static T FirstOrDefault< T > (this IListSource< T > list)
 
static T FirstOrDefault< T > (this IListSource< T > list, T defaultValue)
 
static T Last< T > (this IList< T > list)
 
static T LastOrDefault< T > (this IList< T > list, T defaultValue=default(T))
 
static T Last< T > (this IReadOnlyList< T > list)
 
static T LastOrDefault< T > (this IReadOnlyList< T > list, T defaultValue=default(T))
 
static T Last< T > (this IListAndListSource< T > list)
 
static T LastOrDefault< T > (this IListAndListSource< T > list, T defaultValue=default(T))
 
static T Last< T > (this INegListSource< T > list)
 
static T LastOrDefault< T > (this INegListSource< T > list, T defaultValue=default(T))
 
static IList< T > Skip< T > (this IList< T > list, int start)
 
static IList< T > Take< T > (this IList< T > list, int count)
 
static IListSource< T > Skip< T > (this IListSource< T > list, int start)
 
static IListSource< T > Take< T > (this IListSource< T > list, int count)
 
static IListSource< T > Skip< T > (this IListAndListSource< T > list, int start)
 
static IListSource< T > Take< T > (this IListAndListSource< T > list, int count)
 
static NegListSlice< T > Skip< T > (this INegListSource< T > list, int count)
 
static NegListSlice< T > Take< T > (this INegListSource< T > list, int count)
 
static ListSlice< T > TakeWhile< T > (this IList< T > list, Func< T, bool > predicate)
 
static Slice_< T > TakeWhile< T > (this IListSource< T > list, Func< T, bool > predicate)
 
static NegListSlice< T > TakeWhile< T > (this INegListSource< T > list, Func< T, bool > predicate)
 
static Slice_< T > TakeWhile< T > (this IListAndListSource< T > list, Func< T, bool > predicate)
 
static ListSlice< T > SkipWhile< T > (this IList< T > list, Func< T, bool > predicate)
 
static Slice_< T > SkipWhile< T > (this IListSource< T > list, Func< T, bool > predicate)
 
static NegListSlice< T > SkipWhile< T > (this INegListSource< T > list, Func< T, bool > predicate)
 
static Slice_< T > SkipWhile< T > (this IListAndListSource< T > list, Func< T, bool > predicate)
 
static T[] ToArray< T > (this IReadOnlyList< T > c)
 Copies the contents of an IListSource or IReadOnlyList to an array. More...
 
static T[] ToArray< T > (this INegListSource< T > c)
 Copies the contents of an INegListSource<T> to an array. More...
 
static IListSource< TResult > Select< T, TResult > (this IListSource< T > source, Func< T, TResult > selector)
 
static IList< TResult > Select< T, TResult > (this IList< T > source, Func< T, TResult > selector)
 
static IListSource< TResult > Select< T, TResult > (this IListAndListSource< T > source, Func< T, TResult > selector)
 

Member Function Documentation

static T [] Loyc.Collections.LinqToCollections.ToArray< T > ( this IReadOnlyList< T >  c)
inlinestatic

Copies the contents of an IListSource or IReadOnlyList to an array.

static T [] Loyc.Collections.LinqToCollections.ToArray< T > ( this INegListSource< T >  c)
inlinestatic

Copies the contents of an INegListSource<T> to an array.