List (Of LINQ Enumerable Methods)
Here's a grouped listing of all the methods available on the IEnumerable Class.
Methods which can be composed using VB Query Syntax are generally listed first and are also highlighted yellow.
Projection Operations #
- Select - Projects each element of a sequence into a new form.
- SelectMany - Projects each element of a sequence to an IEnumerable(Of T) and flattens the resulting sequences into one sequence.
Partitioning Data #
- Skip - Bypasses a specified number of elements in a sequence and then returns the remaining elements.
- SkipWhile - Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
- Take - Returns a specified number of contiguous elements from the start of a sequence.
- TakeWhile - Returns elements from a sequence as long as a specified condition is true.
Join Operations #
- Join - Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
- GroupJoin - Correlates the elements of two sequences based on equality of keys and groups the results.
Grouping Data #
- GroupBy - Groups the elements of a sequence according to a specified key selector function.
Filtering Data #
- Where - Filters a sequence of values based on a predicate.
- OfType - Filters the elements of an IEnumerable depending on their ability to be cast to a specified type.
Sorting Data #
- OrderBy - Sorts the elements of a sequence in ascending order according to a key.
- OrderByDescending - Sorts the elements of a sequence in descending order according to a key.
- ThenBy - Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
- ThenByDescending - Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.
- Reverse - Inverts the order of the elements in a sequence.
Aggregation Operations #
- Average - Computes the average of a sequence of values.
- Count - Returns the number of elements in a sequence.
- LongCount - Returns an Int64 that represents the total number of elements in a sequence.
- Max - Returns the maximum value in a sequence of values.
- Min - Returns the minimum value in a sequence of values.
- Sum - Computes the sum of a sequence of values.
- Aggregate - Applies an accumulator function over a sequence.
Set Operations #
- Distinct - Returns distinct elements from a sequence by using the default equality comparer to compare values.
- Except - Produces the set difference of two sequences by using the default equality comparer to compare values.
- Intersect - Produces the set intersection of two sequences by using the default equality comparer to compare values.
- Union - Produces the set union of two sequences by using the default equality comparer.
- Concat - Concatenates two sequences.
- Zip - Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
Quantifier Operations #
- All - Determines whether all elements of a sequence satisfy a condition.
- Any - Determines whether a sequence contains any elements.
- Contains - Determines whether a sequence contains a specified element by using the default equality comparer.
Generation Operations #
- DefaultIfEmpty - Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
- Empty - Returns an empty IEnumerable(Of T) that has the specified type argument.
- Range - Generates a sequence of integral numbers within a specified range.
- Repeat - Generates a sequence that contains one repeated value.
Element Operations #
- First - Returns the first element of a sequence.
- FirstOrDefault - Returns the first element of a sequence, or a default value if the sequence contains no elements.
- Last - Returns the last element of a sequence.
- LastOrDefault - Returns the last element of a sequence, or a default value if the sequence contains no elements.
- ElementAt - Returns the element at a specified index in a sequence.
- ElementAtOrDefault - Returns the element at a specified index in a sequence or a default value if the index is out of range.
- Single - Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
- SingleOrDefault - Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
Equality Operations #
- SequenceEqual - Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.
Converting Data Types #
- Cast - Casts the elements of an IEnumerable to the specified type.
- AsEnumerable - Returns the input typed as IEnumerable(Of T).
- AsQueryable - Converts a (generic) IEnumerable to a (generic) IQueryable.
- ToArray - Creates an array from a IEnumerable(Of T).
- ToDictionary - Creates a Dictionary(Of TKey, TValue) from an IEnumerable(Of T)according to a specified key selector function.
- ToList - Creates a List(Of T) from an IEnumerable(Of T).
- ToLookup - Creates a Lookup(Of TKey, TElement) from an IEnumerable(Of T)according to a specified key selector function.