Additional extension methods for IEnumerable<T>, IReadOnlyCollection<T>, and ICollection<T>, beyond what LINQ provides.
More...
Additional extension methods for IEnumerable<T>, IReadOnlyCollection<T>, and ICollection<T>, beyond what LINQ provides.
The methods include WithIndexes<T>, which pairs each item of a sequence with a 0-based index of that item; ForEach<T>, which runs a lambda for each member of a sequence; IndexWhere<T>, which finds the index where a predicate is true; AdjacentPairs<T>, which pairs each list item with the next one, and MinOrDefault, which finds the item such that some associated value is minimized (in contrast to LINQ's Min(), which just returns the minimum value itself.) And there's more.
|
static BufferedSequence< T > | Buffered< T > (this IEnumerator< T > source) |
|
static BufferedSequence< T > | Buffered< T > (this IEnumerable< T > source) |
|
static IListSource< T > | Buffered< T > (this IListSource< T > source) |
|
static IReadOnlyCollection< T > | AsReadOnly< T > (this ICollection< T > c) |
| Treats any ICollection{T} object to IReadOnlyCollection{T}. More...
|
|
static IReadOnlyDictionary< K, V > | AsReadOnlyDictionary< K, V > (this IReadOnlyCollection< K > keys, Func< K, Maybe< V >> tryGetValue, Func< K, V > getValue=null) |
| Converts a collection of keys to an IReadOnlyDictionary, based on a function that can obtain a value for a given key. More...
|
|
static void | ForEach< T > (this IEnumerable< T > list, Action< T > action) |
|
static IEnumerable< KeyValuePair< int, T > > | WithIndexes< T > (this IEnumerable< T > c) |
|
static ? int | FirstIndexWhere< T > (this IEnumerable< T > list, Func< T, bool > pred) |
| Gets the lowest index at which a condition is true, or null if nowhere. More...
|
|
static int | IndexWhere< T > (this IEnumerable< T > list, Func< T, bool > pred) |
| Gets the lowest index at which a condition is true, or -1 if nowhere. More...
|
|
static int | IndexOfMin (this IEnumerable< int > source) |
|
static int | IndexOfMin< T > (this IEnumerable< T > source, Func< T, int > selector) |
|
static int | IndexOfMin< T > (this IEnumerable< T > source, Func< T, int > selector, out int min) |
|
static int | IndexOfMax (this IEnumerable< int > source) |
|
static int | IndexOfMax< T > (this IEnumerable< T > source, Func< T, int > selector) |
|
static int | IndexOfMax< T > (this IEnumerable< T > source, Func< T, int > selector, out int max) |
|
static int | IndexOfMin< T > (this IEnumerable< T > source) |
|
static int | IndexOfMin< T, R > (this IEnumerable< T > source, Func< T, R > selector) |
|
static int | IndexOfMin< T, R > (this IEnumerable< T > source, Func< T, R > selector, out R min) |
|
static int | IndexOfMax< T > (this IEnumerable< T > source) |
|
static int | IndexOfMax< T, R > (this IEnumerable< T > source, Func< T, R > selector) |
|
static int | IndexOfMax< T, R > (this IEnumerable< T > source, Func< T, R > selector, out R max) |
|
static T | MinOrDefault< T > (this IEnumerable< T > list, Func< T, int > selector, T defaultValue=default(T)) |
| Returns the item in the list that has the minimum value for some selector. More...
|
|
static T | MinOrDefault< T > (this IEnumerable< T > list, Func< T, double > selector, T defaultValue=default(T)) |
|
static IEnumerable< T > | WhereNotNull< T > (this IEnumerable< T > list) |
|
static IEnumerable< T > | WhereNotNull< T > (this IEnumerable< T?> list) |
|
static IEnumerable< Out > | SelectFilter< T, Out > (this IEnumerable< T > list, Func< T, Maybe< Out >> filter) |
| Combines 'Select' and 'Where' in a single operation. More...
|
|
static T | MaxOrDefault< T > (this IEnumerable< T > list, Func< T, int > selector, T defaultValue=default(T)) |
| Returns the item in the list that has the maximum value for some selector. More...
|
|
static T | MaxOrDefault< T > (this IEnumerable< T > list, Func< T, double > selector, T defaultValue=default(T)) |
|
static int | IndexOf< T > (this IEnumerable< T > list, T item) |
| Determines the index of a specific value. More...
|
|
static int | IndexOf< T > (this IEnumerable< T > list, T item, IEqualityComparer< T > comp) |
|
static int | SequenceHashCode< T > (this IEnumerable< T > list) |
| A companion to Enumerable.SequenceEqual<T> that computes a hashcode for a list. More...
|
|
static int | SequenceHashCode< T > (this IEnumerable< T > list, IEqualityComparer< T > comp) |
|
static IEnumerable< Base > | Upcast< Base, Derived > (this IEnumerable< Derived > list) |
| Upcasts a sequence. More...
|
|
static IEnumerable< Pair< T, T > > | AdjacentPairs< T > (this IEnumerable< T > list) |
| Returns all adjacent pairs (e.g. for the list {1,2,3}, returns {(1,2),(2,3)}) More...
|
|
static IEnumerable< Pair< T, T > > | AdjacentPairs< T > (this IEnumerator< T > e) |
|
static IEnumerable< Pair< T, T > > | AdjacentPairsCircular< T > (this IEnumerable< T > list) |
| Returns all adjacent pairs, treating the first and last pairs as adjacent (e.g. for the list {1,2,3,4}, returns the pairs {(1,2),(2,3),(3,4),(4,1)}.) More...
|
|
static IEnumerable< Pair< T, T > > | AdjacentPairsCircular< T > (this IEnumerator< T > e) |
|
static List< T > | ToList< T > (this IEnumerator< T > e) |
|