type.
bool | All<T>(this IEnumerable<T> source, Func<T, int, bool> predicate) |
Determines whether all elements of a sequence satisfy a condition by incorporating the element's index. |
IEnumerable<ValueTuple<T, T>> | |
Returns an enumeration of tuples containing all pairs of elements from the source collection. For example, the
input sequence 1, 2 yields the pairs [1,1], [1,2], [2,1], and [2,2]. |
IEnumerable<TResult> | AllPairs<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TSource, TResult> selector) | Returns an enumeration of objects computed from all pairs of elements from the source collection. |
bool | | Determines whether all the input sequences are equal according to SequenceEquals. |
bool | Any<T>(this IEnumerable<T> source, Func<T, int, bool> predicate) |
Determines whether any element of a sequence satisfies a condition by incorporating the element's index. |
IEnumerable<T> | Concat<T>(this IEnumerable<T> source, T element) |
Adds a single element to the end of an IEnumerable<T>. |
IEnumerable<T> | Concat<T>(this T head, IEnumerable<T> tail) |
Adds a single element to the start of an IEnumerable<T>. |
IEnumerable<ValueTuple<T, T>> | |
Returns an enumeration of tuples containing all consecutive pairs of the elements. |
T | |
Returns the first element of a sequence, or a default value if the sequence contains no elements. |
T | FirstOrDefault<T>(this IEnumerable<T> source, Func<T, bool> predicate, T default) |
TResult | FirstOrDefault<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> resultSelector, TResult default) |
T? | |
Returns the first element of a sequence, or null if the sequence contains no elements. |
T? | FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate) |
Returns the first element of a sequence that satisfies a given predicate, or null if the sequence
contains no elements. |
IEnumerable<ConsecutiveGroup<TItem, TItem>> | GroupConsecutive<TItem>(this IEnumerable<TItem> source, Func<TItem, TItem, bool> itemEquality) |
Accumulates consecutive equal elements. |
IEnumerable<ConsecutiveGroup<TItem, TItem>> | GroupConsecutive<TItem>(this IEnumerable<TItem> source, IEqualityComparer<TItem> itemComparer = null) |
IEnumerable<ConsecutiveGroup<TItem, TKey>> | GroupConsecutiveBy<TItem, TKey>(this IEnumerable<TItem> source, Func<TItem, TKey> selector, IEqualityComparer<TKey> keyComparer = null) |
Accumulates consecutive elements that are equal when processed by a selector. |
int | IndexOf<T>(this IEnumerable<T> source, Func<T, bool> predicate) |
Returns the index of the first element in this source satisfying the specified predicate. If no such elements are found, returns -1 . |
int | IndexOf<T>(this IEnumerable<T> source, Func<T, int, bool> predicate) |
Returns the index of the first element in this source satisfying the specified predicate. The second parameter receives the index of each element. If no such elements are found,
returns -1 . |
int | IndexOf<T>(this IEnumerable<T> source, Func<T, bool> predicate, int startIndex) |
Returns the index of the first element in this source satisfying the specified predicate, starting at the specified startIndex. If no such elements are found,
returns -1 . |
int | IndexOf<T>(this IEnumerable<T> source, T element, IEqualityComparer<T> comparer = null) |
Returns the index of the first element in this source that is equal to the specified
element as determined by the specified comparer. If no such elements are
found, returns -1 . |
IEnumerable<T> | |
Inserts the specified item in between each element in the input collection. |
IEnumerable<T> | |
Inserts the comma item in between each element in the input collection except between the
second-last and last, where it inserts and instead. |
string | JoinString<T>(this IEnumerable<T> values, string separator = null, string prefix = null, string suffix = null, string lastSeparator = null) |
Turns all elements in the enumerable to strings and joins them using the specified separator and the specified prefix and suffix for each string. |
int | LastIndexOf<T>(this IEnumerable<T> source, Func<T, bool> predicate) |
Returns the index of the last element in this source satisfying the specified predicate. If no such elements are found, returns -1 . |
T | MaxCountElement<T>(this IEnumerable<T> source, IEqualityComparer<T> comparer = null) |
Determines which element occurs the most often in the specified input sequence. |
T | MaxCountElement<T>(this IEnumerable<T> source, out int count, IEqualityComparer<T> comparer = null) |
Determines which element occurs the most often in the specified input sequence, and how often. |
T | MaxElement<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector) |
Returns the first element from the input sequence for which the value selector returns the largest value. |
T | MaxElementOrDefault<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector, T defaultValue = null) |
Returns the first element from the input sequence for which the value selector returns the largest value, or a
default value if the collection is empty. |
IEnumerable<T> | MaxElements<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector) |
Returns all elements for which the valueSelector returns the largest value, or an empty
sequence if the input sequence is empty. |
int | MaxIndex<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector) |
Returns the index of the first element from the input sequence for which the value selector returns the
largest value. |
int? | MaxIndexOrNull<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector) |
Returns the index of the first element from the input sequence for which the value selector returns the
largest value, or a default value if the collection is empty. |
TSource | MaxOrDefault<TSource>(this IEnumerable<TSource> source, TSource default = null) |
Returns the maximum resulting value in a sequence, or a default value if the sequence is empty. |
TResult | MaxOrDefault<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, TResult default = null) |
Invokes a selector on each element of a collection and returns the maximum resulting value, or a default value
if the sequence is empty. |
TSource? | MaxOrNull<TSource>(this IEnumerable<TSource> source) |
Returns the maximum resulting value in a sequence, or null if the sequence is empty. |
TResult? | MaxOrNull<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) |
Invokes a selector on each element of a collection and returns the maximum resulting value, or null if
the sequence is empty. |
T | MinElement<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector) |
Returns the first element from the input sequence for which the value selector returns the smallest value. |
T | MinElementOrDefault<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector, T defaultValue = null) |
Returns the first element from the input sequence for which the value selector returns the smallest value, or
a default value if the collection is empty. |
IEnumerable<T> | MinElements<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector) |
Returns all elements for which the valueSelector returns the smallest value, or an empty
sequence if the input sequence is empty. |
int | MinIndex<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector) |
Returns the index of the first element from the input sequence for which the value selector returns the
smallest value. |
int? | MinIndexOrNull<T, TValue>(this IEnumerable<T> source, Func<T, TValue> valueSelector) |
Returns the index of the first element from the input sequence for which the value selector returns the
smallest value, or null if the collection is empty. |
TSource | MinOrDefault<TSource>(this IEnumerable<TSource> source, TSource default = null) |
Returns the minimum resulting value in a sequence, or a default value if the sequence is empty. |
TResult | MinOrDefault<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, TResult default = null) |
Invokes a selector on each element of a collection and returns the minimum resulting value, or a default value
if the sequence is empty. |
TSource? | MinOrNull<TSource>(this IEnumerable<TSource> source) |
Returns the minimum resulting value in a sequence, or null if the sequence is empty. |
TResult? | MinOrNull<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) |
Invokes a selector on each element of a collection and returns the minimum resulting value, or null if
the sequence is empty. |
IEnumerable<T> | Order<T>(this IEnumerable<T> source) | Sorts the elements of a sequence in ascending order. |
IEnumerable<T> | Order<T>(this IEnumerable<T> source, IComparer<T> comparer) | Sorts the elements of a sequence in ascending order by using a specified comparer. |
IEnumerable<T> | |
Orders the items, lazily. It is much faster when extracting only the first few items using Enumerable.Take<TM1>(IEnumerable<TM1>, int). |
IEnumerable<T> | OrderLazy<T>(this IEnumerable<T> source, IComparer<T> comparer) |
IEnumerable<IEnumerable<T>> | |
Returns all permutations of the input IEnumerable<T>. |
IEnumerable<T> | |
Enumerates a chain of objects where each object refers to the next one. The chain starts with the specified
object and ends when null is encountered. |
IEnumerable<TResult> | |
Enumerates all consecutive pairs of the elements. |
IEnumerable<int> | |
Returns a collection of integers containing the indexes at which the elements of the source collection match
the given predicate. |
IEnumerable<TResult?> | | Returns the original collection but with every value cast to their nullable equivalent. |
IEnumerable<TResult> | SelectTwo<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector1, Func<TSource, TResult> selector2) |
Transforms every element of an input collection using two selector functions and returns a collection
containing all the results. |
bool | SequenceEqual<T>(this IEnumerable<T> sequence1, params T[] sequence2) | Determines whether this sequence comprises the values provided in the specified order. |
IEnumerable<T> | SkipLast<T>(this IEnumerable<T> source, int count, bool throwIfNotEnough = false) |
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. |
IEnumerable<IEnumerable<T>> | Split<T>(this IEnumerable<T> splitWhat, Func<T, bool> splitWhere) |
Splits the specified IEnumerable at every element that satisfies a specified predicate and returns a
collection containing each sequence of elements in between each pair of such elements. The elements satisfying
the predicate are not included. |
IEnumerable<IEnumerable<T>> | Split<T>(this IEnumerable<T> source, int chunkSize) |
Splits a collection into chunks of equal size. The last chunk may be smaller than chunkSize, but all chunks, if any, will contain at least one item. |
bool | StartsWith<T>(this IEnumerable<T> source, IEnumerable<T> sequence) | Returns true if and only if the input collection begins with the specified collection. |
bool | StartsWith<T>(this IEnumerable<T> source, IEnumerable<T> sequence, IEqualityComparer<T> comparer) |
IEnumerable<IEnumerable<T>> | Subsequences<T>(this IEnumerable<T> source, int minLength = 0, int? maxLength = null) |
Returns all subsequences of the specified lengths of the input IEnumerable<T>. |
int | | Returns the sum of the values in the specified collection, truncated to a 32-bit integer. |
int | SumUnchecked<T>(this IEnumerable<T> source, Func<T, int> selector) |
Returns the sum of the values in the specified collection projected by the specified selector function,
truncated to a 32-bit integer. |
Dictionary<TKey, TValue> | ToDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey> comparer = null, bool ignoreDuplicateKeys = false) |
Converts an IEnumerable<KeyValuePair<TKey, TValue>> into a Dictionary<TKey,
TValue> . |
Dictionary<TKey1, Dictionary<TKey2, TSource>> | ToDictionary2<TSource, TKey1, TKey2>(this IEnumerable<TSource> source, Func<TSource, TKey1> key1Selector, Func<TSource, TKey2> key2Selector, IEqualityComparer<TKey1> comparer1 = null, IEqualityComparer<TKey2> comparer2 = null) |
Creates a two-level dictionary from an enumerable collection according to two specified key selector functions
and optional key comparers. |
Dictionary<TKey1, Dictionary<TKey2, TValue>> | ToDictionary2<TSource, TKey1, TKey2, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey1> key1Selector, Func<TSource, TKey2> key2Selector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey1> comparer1 = null, IEqualityComparer<TKey2> comparer2 = null) |
Queue<T> | ToQueue<T>(this IEnumerable<T> source) | Creates a Queue<T> from an enumerable collection. |
Stack<T> | ToStack<T>(this IEnumerable<T> source) | Creates a Stack<T> from an enumerable collection. |
IEnumerable<ValueTuple<T, T>> | |
Returns an enumeration of tuples containing all unique pairs of distinct elements from the source collection.
For example, the input sequence 1, 2, 3 yields the pairs [1,2], [1,3] and [2,3] only. |
IEnumerable<T> | |
Returns only the non-null elements from the specified collection of nullable values as non-nullable
values. |