Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Linq.​Enumerable
Assembly: System.Linq
Inheritance: object → Enumerable
Provides a set of <see langword="static" /> ( <see langword="Shared" /> in Visual Basic) methods for querying objects that implement <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
Methods
public static
TSource
Aggregate​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TSource, TSource> func)
Applies an accumulator function over a sequence.
Returns The final accumulator value.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to aggregate over.
func
An accumulator function to be invoked on each element.
public static
TAccumulate
Aggregate​(Collections.​Generic.​IEnumerable<​TSource> source,
TAccumulate seed,
Func<​TAccumulate, TSource, TAccumulate> func)
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
Returns The final accumulator value.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to aggregate over.
seed
The initial accumulator value.
func
An accumulator function to be invoked on each element.
public static
TResult
Aggregate​(Collections.​Generic.​IEnumerable<​TSource> source,
TAccumulate seed,
Func<​TAccumulate, TSource, TAccumulate> func,
Func<​TAccumulate, TResult> resultSelector)
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
Returns The transformed final accumulator value.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to aggregate over.
seed
The initial accumulator value.
func
An accumulator function to be invoked on each element.
resultSelector
A function to transform the final accumulator value into the result value.
public static
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​TKey, TAccumulate>>
AggregateBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
TAccumulate seed,
Func<​TAccumulate, TSource, TAccumulate> func,
Collections.​Generic.​IEqualityComparer?<​TKey> keyComparer = null)
Applies an accumulator function over a sequence, grouping results by key.
Returns An enumerable containing the aggregates corresponding to each key deriving from <paramref name="source" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to aggregate over.
keySelector
A function to extract the key for each element.
seed
The initial accumulator value.
func
An accumulator function to be invoked on each element.
keyComparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys with.
public static
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​TKey, TAccumulate>>
AggregateBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TKey, TAccumulate> seedSelector,
Func<​TAccumulate, TSource, TAccumulate> func,
Collections.​Generic.​IEqualityComparer?<​TKey> keyComparer = null)
Applies an accumulator function over a sequence, grouping results by key.
Returns An enumerable containing the aggregates corresponding to each key deriving from <paramref name="source" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to aggregate over.
keySelector
A function to extract the key for each element.
seedSelector
A factory for the initial accumulator value.
func
An accumulator function to be invoked on each element.
keyComparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys with.
public static
bool
All​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Determines whether all elements of a sequence satisfy a condition.
Returns <see langword="true" /> if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, <see langword="false" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements to apply the predicate to.
predicate
A function to test each element for a condition.
public static
bool
Any​(Collections.​Generic.​IEnumerable<​TSource> source)
Determines whether a sequence contains any elements.
Returns <see langword="true" /> if the source sequence contains any elements; otherwise, <see langword="false" /> .
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to check for emptiness.
public static
bool
Any​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Determines whether any element of a sequence satisfies a condition.
Returns <see langword="true" /> if the source sequence is not empty and at least one of its elements passes the test in the specified predicate; otherwise, <see langword="false" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to apply the predicate to.
predicate
A function to test each element for a condition.
public static
Collections.​Generic.​IEnumerable<​TSource>
Append​(Collections.​Generic.​IEnumerable<​TSource> source,
TSource element)
Appends a value to the end of the sequence.
Returns A new sequence that ends with <paramref name="element" /> .
source
A sequence of values.
element
The value to append to <paramref name="source" /> .
public static
Collections.​Generic.​IEnumerable<​TSource>
AsEnumerable​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the input typed as <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
Returns The input sequence typed as <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
source
The sequence to type as <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
public static
decimal
Average​(Collections.​Generic.​IEnumerable<​decimal> source)
Computes the average of a sequence of <see cref="T:System.Decimal" /> values.
Returns The average of the sequence of values.
source
A sequence of <see cref="T:System.Decimal" /> values to calculate the average of.
public static
double
Average​(Collections.​Generic.​IEnumerable<​double> source)
Computes the average of a sequence of <see cref="T:System.Double" /> values.
Returns The average of the sequence of values.
source
A sequence of <see cref="T:System.Double" /> values to calculate the average of.
public static
double
Average​(Collections.​Generic.​IEnumerable<​int> source)
Computes the average of a sequence of <see cref="T:System.Int32" /> values.
Returns The average of the sequence of values.
source
A sequence of <see cref="T:System.Int32" /> values to calculate the average of.
public static
double
Average​(Collections.​Generic.​IEnumerable<​long> source)
Computes the average of a sequence of <see cref="T:System.Int64" /> values.
Returns The average of the sequence of values.
source
A sequence of <see cref="T:System.Int64" /> values to calculate the average of.
public static
decimal?
Average​(Collections.​Generic.​IEnumerable<​decimal?> source)
Computes the average of a sequence of nullable <see cref="T:System.Decimal" /> values.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the average of.
public static
double?
Average​(Collections.​Generic.​IEnumerable<​double?> source)
Computes the average of a sequence of nullable <see cref="T:System.Double" /> values.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of nullable <see cref="T:System.Double" /> values to calculate the average of.
public static
double?
Average​(Collections.​Generic.​IEnumerable<​int?> source)
Computes the average of a sequence of nullable <see cref="T:System.Int32" /> values.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of nullable <see cref="T:System.Int32" /> values to calculate the average of.
public static
double?
Average​(Collections.​Generic.​IEnumerable<​long?> source)
Computes the average of a sequence of nullable <see cref="T:System.Int64" /> values.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of nullable <see cref="T:System.Int64" /> values to calculate the average of.
public static
Single?
Average​(Collections.​Generic.​IEnumerable<​Single?> source)
Computes the average of a sequence of nullable <see cref="T:System.Single" /> values.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of nullable <see cref="T:System.Single" /> values to calculate the average of.
public static
Single
Average​(Collections.​Generic.​IEnumerable<​Single> source)
Computes the average of a sequence of <see cref="T:System.Single" /> values.
Returns The average of the sequence of values.
source
A sequence of <see cref="T:System.Single" /> values to calculate the average of.
public static
decimal
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, decimal> selector)
Computes the average of a sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values.
source
A sequence of values that are used to calculate an average.
selector
A transform function to apply to each element.
public static
double
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, double> selector)
Computes the average of a sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values.
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
double
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int> selector)
Computes the average of a sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values.
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
double
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, long> selector)
Computes the average of a sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values.
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
decimal?
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, decimal?> selector)
Computes the average of a sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
double?
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, double?> selector)
Computes the average of a sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
double?
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int?> selector)
Computes the average of a sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
double?
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, long?> selector)
Computes the average of a sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
Single?
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Single?> selector)
Computes the average of a sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values, or <see langword="null" /> if the source sequence is empty or contains only values that are <see langword="null" /> .
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
Single
Average​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Single> selector)
Computes the average of a sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The average of the sequence of values.
source
A sequence of values to calculate the average of.
selector
A transform function to apply to each element.
public static
Collections.​Generic.​IEnumerable<​TResult>
Cast​(Collections.​IEnumerable source)
Casts the elements of an <see cref="T:System.Collections.IEnumerable" /> to the specified type.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains each element of the source sequence cast to the specified type.
source
The <see cref="T:System.Collections.IEnumerable" /> that contains the elements to be cast to type <typeparamref name="TResult" /> .
public static
Collections.​Generic.​IEnumerable<​TSource[]>
Chunk​(Collections.​Generic.​IEnumerable<​TSource> source,
int size)
Splits the elements of a sequence into chunks of size at most <paramref name="size" /> .
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements the input sequence split into chunks of size <paramref name="size" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to chunk.
size
The maximum size of each chunk.
public static
Collections.​Generic.​IEnumerable<​TSource>
Concat​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second)
Concatenates two sequences.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the concatenated elements of the two input sequences.
first
The first sequence to concatenate.
second
The sequence to concatenate to the first sequence.
public static
bool
Contains​(Collections.​Generic.​IEnumerable<​TSource> source,
TSource value)
Determines whether a sequence contains a specified element by using the default equality comparer.
Returns <see langword="true" /> if the source sequence contains an element that has the specified value; otherwise, <see langword="false" /> .
source
A sequence in which to locate a value.
value
The value to locate in the sequence.
public static
bool
Contains​(Collections.​Generic.​IEnumerable<​TSource> source,
TSource value,
Collections.​Generic.​IEqualityComparer?<​TSource> comparer)
Determines whether a sequence contains a specified element by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> .
Returns <see langword="true" /> if the source sequence contains an element that has the specified value; otherwise, <see langword="false" /> .
source
A sequence in which to locate a value.
value
The value to locate in the sequence.
comparer
An equality comparer to compare values.
public static
int
Count​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the number of elements in a sequence.
Returns The number of elements in the input sequence.
source
A sequence that contains elements to be counted.
public static
int
Count​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns a number that represents how many elements in the specified sequence satisfy a condition.
Returns A number that represents how many elements in the sequence satisfy the condition in the predicate function.
source
A sequence that contains elements to be tested and counted.
predicate
A function to test each element for a condition.
public static
Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​TKey, int>>
CountBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IEqualityComparer?<​TKey> keyComparer = null)
Returns the count of elements in the source sequence grouped by key.
Returns An enumerable containing the frequencies of each key occurrence in <paramref name="source" /> .
source
A sequence that contains elements to be counted.
keySelector
A function to extract the key for each element.
keyComparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys with.
public static
Collections.​Generic.​IEnumerable<​TSource>
DefaultIfEmpty​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> object that contains the default value for the <typeparamref name="TSource" /> type if <paramref name="source" /> is empty; otherwise, <paramref name="source" /> .
source
The sequence to return a default value for if it is empty.
public static
Collections.​Generic.​IEnumerable<​TSource>
DefaultIfEmpty​(Collections.​Generic.​IEnumerable<​TSource> source,
TSource defaultValue)
Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <paramref name="defaultValue" /> if <paramref name="source" /> is empty; otherwise, <paramref name="source" /> .
source
The sequence to return the specified value for if it is empty.
defaultValue
The value to return if the sequence is empty.
public static
Collections.​Generic.​IEnumerable<​TSource>
DistinctBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Returns distinct elements from a sequence according to a specified key selector function.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains distinct elements from the source sequence.
source
The sequence to remove duplicate elements from.
keySelector
A function to extract the key for each element.
public static
Collections.​Generic.​IEnumerable<​TSource>
DistinctBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Returns distinct elements from a sequence according to a specified key selector function and using a specified comparer to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains distinct elements from the source sequence.
source
The sequence to remove duplicate elements from.
keySelector
A function to extract the key for each element.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
Collections.​Generic.​IEnumerable<​TSource>
Distinct​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns distinct elements from a sequence by using the default equality comparer to compare values.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains distinct elements from the source sequence.
source
The sequence to remove duplicate elements from.
public static
Collections.​Generic.​IEnumerable<​TSource>
Distinct​(Collections.​Generic.​IEnumerable<​TSource> source,
Collections.​Generic.​IEqualityComparer?<​TSource> comparer)
Returns distinct elements from a sequence by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains distinct elements from the source sequence.
source
The sequence to remove duplicate elements from.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
public static
TSource
ElementAtOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
Index index)
Returns the element at a specified index in a sequence or a default value if the index is out of range.
Returns <see langword="default" /> if <paramref name="index" /> is outside the bounds of the <paramref name="source" /> sequence; otherwise, the element at the specified position in the <paramref name="source" /> sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
index
The index of the element to retrieve, which is either from the beginning or the end of the sequence.
public static
TSource
ElementAtOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
int index)
Returns the element at a specified index in a sequence or a default value if the index is out of range.
Returns <see langword="default" /> ( <typeparamref name="TSource" /> ) if the index is outside the bounds of the source sequence; otherwise, the element at the specified position in the source sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
index
The zero-based index of the element to retrieve.
public static
TSource
ElementAt​(Collections.​Generic.​IEnumerable<​TSource> source,
Index index)
Returns the element at a specified index in a sequence.
Returns The element at the specified position in the <paramref name="source" /> sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
index
The index of the element to retrieve, which is either from the beginning or the end of the sequence.
public static
TSource
ElementAt​(Collections.​Generic.​IEnumerable<​TSource> source,
int index)
Returns the element at a specified index in a sequence.
Returns The element at the specified position in the source sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
index
The zero-based index of the element to retrieve.
public static
Collections.​Generic.​IEnumerable<​TResult>
Empty​()
Returns an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has the specified type argument.
Returns An empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose type argument is <typeparamref name="TResult" /> .
public static
Collections.​Generic.​IEnumerable<​TSource>
ExceptBy​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TKey> second,
Func<​TSource, TKey> keySelector)
Produces the set difference of two sequences according to a specified key selector function.
Returns A sequence that contains the set difference of the elements of two sequences.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose keys that are not also in <paramref name="second" /> will be returned.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.
keySelector
A function to extract the key for each element.
public static
Collections.​Generic.​IEnumerable<​TSource>
ExceptBy​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TKey> second,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Produces the set difference of two sequences according to a specified key selector function.
Returns A sequence that contains the set difference of the elements of two sequences.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose keys that are not also in <paramref name="second" /> will be returned.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.
keySelector
A function to extract the key for each element.
comparer
The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
public static
Collections.​Generic.​IEnumerable<​TSource>
Except​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second)
Produces the set difference of two sequences by using the default equality comparer to compare values.
Returns A sequence that contains the set difference of the elements of two sequences.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that are not also in <paramref name="second" /> will be returned.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.
public static
Collections.​Generic.​IEnumerable<​TSource>
Except​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second,
Collections.​Generic.​IEqualityComparer?<​TSource> comparer)
Produces the set difference of two sequences by using the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
Returns A sequence that contains the set difference of the elements of two sequences.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that are not also in <paramref name="second" /> will be returned.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
public static
TSource
FirstOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the first element of a sequence, or a default value if the sequence contains no elements.
Returns <see langword="default" /> ( <typeparamref name="TSource" /> ) if <paramref name="source" /> is empty; otherwise, the first element in <paramref name="source" /> .
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the first element of.
public static
TSource
FirstOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
TSource defaultValue)
Returns the first element of a sequence, or a specified default value if the sequence contains no elements.
Returns <paramref name="defaultValue" /> if <paramref name="source" /> is empty; otherwise, the first element in <paramref name="source" /> .
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the first element of.
defaultValue
The default value to return if the sequence is empty.
public static
TSource
FirstOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
Returns <see langword="default" /> ( <typeparamref name="TSource" /> ) if <paramref name="source" /> is empty or if no element passes the test specified by <paramref name="predicate" /> ; otherwise, the first element in <paramref name="source" /> that passes the test specified by <paramref name="predicate" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
predicate
A function to test each element for a condition.
public static
TSource
FirstOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate,
TSource defaultValue)
Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found.
Returns <paramref name="defaultValue" /> if <paramref name="source" /> is empty or if no element passes the test specified by <paramref name="predicate" /> ; otherwise, the first element in <paramref name="source" /> that passes the test specified by <paramref name="predicate" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
predicate
A function to test each element for a condition.
defaultValue
The default value to return if the sequence is empty.
public static
TSource
First​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the first element of a sequence.
Returns The first element in the specified sequence.
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the first element of.
public static
TSource
First​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns the first element in a sequence that satisfies a specified condition.
Returns The first element in the sequence that passes the test in the specified predicate function.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
predicate
A function to test each element for a condition.
public static
Collections.​Generic.​IEnumerable<​IGrouping<​TKey, TSource>>
GroupBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Groups the elements of a sequence according to a specified key selector function.
Returns An <c>IEnumerable<IGrouping<TKey, TSource>></c> in C# or <c>IEnumerable(Of IGrouping(Of TKey, TSource))</c> in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a sequence of objects and a key.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.
keySelector
A function to extract the key for each element.
public static
Collections.​Generic.​IEnumerable<​IGrouping<​TKey, TSource>>
GroupBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer.
Returns An <c>IEnumerable<IGrouping<TKey, TSource>></c> in C# or <c>IEnumerable(Of IGrouping(Of TKey, TSource))</c> in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a collection of objects and a key.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.
keySelector
A function to extract the key for each element.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
Collections.​Generic.​IEnumerable<​IGrouping<​TKey, TElement>>
GroupBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TSource, TElement> elementSelector)
Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function.
Returns An <c>IEnumerable<IGrouping<TKey, TElement>></c> in C# or <c>IEnumerable(Of IGrouping(Of TKey, TElement))</c> in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a collection of objects of type <typeparamref name="TElement" /> and a key.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.
keySelector
A function to extract the key for each element.
elementSelector
A function to map each source element to an element in the <see cref="T:System.Linq.IGrouping`2" /> .
public static
Collections.​Generic.​IEnumerable<​IGrouping<​TKey, TElement>>
GroupBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TSource, TElement> elementSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function.
Returns An <c>IEnumerable<IGrouping<TKey, TElement>></c> in C# or <c>IEnumerable(Of IGrouping(Of TKey, TElement))</c> in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a collection of objects of type <typeparamref name="TElement" /> and a key.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.
keySelector
A function to extract the key for each element.
elementSelector
A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" /> .
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
Collections.​Generic.​IEnumerable<​TResult>
GroupBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TKey, Collections.​Generic.​IEnumerable<​TSource>, TResult> resultSelector)
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.
Returns A collection of elements of type <typeparamref name="TResult" /> where each element represents a projection over a group and its key.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.
keySelector
A function to extract the key for each element.
resultSelector
A function to create a result value from each group.
public static
Collections.​Generic.​IEnumerable<​TResult>
GroupBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TKey, Collections.​Generic.​IEnumerable<​TSource>, TResult> resultSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer.
Returns A collection of elements of type <typeparamref name="TResult" /> where each element represents a projection over a group and its key.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.
keySelector
A function to extract the key for each element.
resultSelector
A function to create a result value from each group.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys with.
public static
Collections.​Generic.​IEnumerable<​TResult>
GroupBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TSource, TElement> elementSelector,
Func<​TKey, Collections.​Generic.​IEnumerable<​TElement>, TResult> resultSelector)
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function.
Returns A collection of elements of type <typeparamref name="TResult" /> where each element represents a projection over a group and its key.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.
keySelector
A function to extract the key for each element.
elementSelector
A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" /> .
resultSelector
A function to create a result value from each group.
public static
Collections.​Generic.​IEnumerable<​TResult>
GroupBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TSource, TElement> elementSelector,
Func<​TKey, Collections.​Generic.​IEnumerable<​TElement>, TResult> resultSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function.
Returns A collection of elements of type <typeparamref name="TResult" /> where each element represents a projection over a group and its key.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.
keySelector
A function to extract the key for each element.
elementSelector
A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" /> .
resultSelector
A function to create a result value from each group.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys with.
public static
Collections.​Generic.​IEnumerable<​TResult>
GroupJoin​(Collections.​Generic.​IEnumerable<​TOuter> outer,
Collections.​Generic.​IEnumerable<​TInner> inner,
Func<​TOuter, TKey> outerKeySelector,
Func<​TInner, TKey> innerKeySelector,
Func<​TOuter, Collections.​Generic.​IEnumerable<​TInner>, TResult> resultSelector)
Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements of type <typeparamref name="TResult" /> that are obtained by performing a grouped join on two sequences.
outer
The first sequence to join.
inner
The sequence to join to the first sequence.
outerKeySelector
A function to extract the join key from each element of the first sequence.
innerKeySelector
A function to extract the join key from each element of the second sequence.
resultSelector
A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.
public static
Collections.​Generic.​IEnumerable<​TResult>
GroupJoin​(Collections.​Generic.​IEnumerable<​TOuter> outer,
Collections.​Generic.​IEnumerable<​TInner> inner,
Func<​TOuter, TKey> outerKeySelector,
Func<​TInner, TKey> innerKeySelector,
Func<​TOuter, Collections.​Generic.​IEnumerable<​TInner>, TResult> resultSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Correlates the elements of two sequences based on key equality and groups the results. A specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> is used to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements of type <typeparamref name="TResult" /> that are obtained by performing a grouped join on two sequences.
outer
The first sequence to join.
inner
The sequence to join to the first sequence.
outerKeySelector
A function to extract the join key from each element of the first sequence.
innerKeySelector
A function to extract the join key from each element of the second sequence.
resultSelector
A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to hash and compare keys.
public static
Collections.​Generic.​IEnumerable<​ValueTuple<​int, TSource>>
Index​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns an enumerable that incorporates the element's index into a tuple.
Returns An enumerable that incorporates each element index into a tuple.
source
The source enumerable providing the elements.
public static
Collections.​Generic.​IEnumerable<​T>
InfiniteSequence​(T start,
T step)
Generates an infinite sequence that begins with <paramref name="start" /> and yields additional values each incremented by <paramref name="step" /> .
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the sequence.
start
The starting value.
step
The amount by which the next yielded value should be incremented from the previous yielded value.
public static
Collections.​Generic.​IEnumerable<​TSource>
IntersectBy​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TKey> second,
Func<​TSource, TKey> keySelector)
Produces the set intersection of two sequences according to a specified key selector function.
Returns A sequence that contains the elements that form the set intersection of two sequences.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in <paramref name="second" /> will be returned.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in the first sequence will be returned.
keySelector
A function to extract the key for each element.
public static
Collections.​Generic.​IEnumerable<​TSource>
IntersectBy​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TKey> second,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Produces the set intersection of two sequences according to a specified key selector function.
Returns A sequence that contains the elements that form the set intersection of two sequences.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in <paramref name="second" /> will be returned.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in the first sequence will be returned.
keySelector
A function to extract the key for each element.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
Collections.​Generic.​IEnumerable<​TSource>
Intersect​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second)
Produces the set intersection of two sequences by using the default equality comparer to compare values.
Returns A sequence that contains the elements that form the set intersection of two sequences.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in <paramref name="second" /> will be returned.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in the first sequence will be returned.
public static
Collections.​Generic.​IEnumerable<​TSource>
Intersect​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second,
Collections.​Generic.​IEqualityComparer?<​TSource> comparer)
Produces the set intersection of two sequences by using the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
Returns A sequence that contains the elements that form the set intersection of two sequences.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in <paramref name="second" /> will be returned.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in the first sequence will be returned.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
public static
Collections.​Generic.​IEnumerable<​TResult>
Join​(Collections.​Generic.​IEnumerable<​TOuter> outer,
Collections.​Generic.​IEnumerable<​TInner> inner,
Func<​TOuter, TKey> outerKeySelector,
Func<​TInner, TKey> innerKeySelector,
Func<​TOuter, TInner, TResult> resultSelector)
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has elements of type <typeparamref name="TResult" /> that are obtained by performing an inner join on two sequences.
outer
The first sequence to join.
inner
The sequence to join to the first sequence.
outerKeySelector
A function to extract the join key from each element of the first sequence.
innerKeySelector
A function to extract the join key from each element of the second sequence.
resultSelector
A function to create a result element from two matching elements.
public static
Collections.​Generic.​IEnumerable<​TResult>
Join​(Collections.​Generic.​IEnumerable<​TOuter> outer,
Collections.​Generic.​IEnumerable<​TInner> inner,
Func<​TOuter, TKey> outerKeySelector,
Func<​TInner, TKey> innerKeySelector,
Func<​TOuter, TInner, TResult> resultSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Correlates the elements of two sequences based on matching keys. A specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> is used to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has elements of type <typeparamref name="TResult" /> that are obtained by performing an inner join on two sequences.
outer
The first sequence to join.
inner
The sequence to join to the first sequence.
outerKeySelector
A function to extract the join key from each element of the first sequence.
innerKeySelector
A function to extract the join key from each element of the second sequence.
resultSelector
A function to create a result element from two matching elements.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to hash and compare keys.
public static
TSource
LastOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the last element of a sequence, or a default value if the sequence contains no elements.
Returns <see langword="default" /> ( <typeparamref name="TSource" /> ) if the source sequence is empty; otherwise, the last element in the <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the last element of.
public static
TSource
LastOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
TSource defaultValue)
Returns the last element of a sequence, or a specified default value if the sequence contains no elements.
Returns <paramref name="defaultValue" /> if the source sequence is empty; otherwise, the last element in the <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the last element of.
defaultValue
The default value to return if the sequence is empty.
public static
TSource
LastOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.
Returns <see langword="default" /> ( <typeparamref name="TSource" /> ) if the sequence is empty or if no elements pass the test in the predicate function; otherwise, the last element that passes the test in the predicate function.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
predicate
A function to test each element for a condition.
public static
TSource
LastOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate,
TSource defaultValue)
Returns the last element of a sequence that satisfies a condition, or a specified default value if no such element is found.
Returns <paramref name="defaultValue" /> if the sequence is empty or if no elements pass the test in the predicate function; otherwise, the last element that passes the test in the predicate function.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
predicate
A function to test each element for a condition.
defaultValue
The default value to return if the sequence is empty.
public static
TSource
Last​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the last element of a sequence.
Returns The value at the last position in the source sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the last element of.
public static
TSource
Last​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns the last element of a sequence that satisfies a specified condition.
Returns The last element in the sequence that passes the test in the specified predicate function.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.
predicate
A function to test each element for a condition.
public static
Collections.​Generic.​IEnumerable<​TResult>
LeftJoin​(Collections.​Generic.​IEnumerable<​TOuter> outer,
Collections.​Generic.​IEnumerable<​TInner> inner,
Func<​TOuter, TKey> outerKeySelector,
Func<​TInner, TKey> innerKeySelector,
Func<​TOuter, TInner, TResult> resultSelector)
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has elements of type <typeparamref name="TResult" /> that are obtained by performing a left outer join on two sequences.
outer
The first sequence to join.
inner
The sequence to join to the first sequence.
outerKeySelector
A function to extract the join key from each element of the first sequence.
innerKeySelector
A function to extract the join key from each element of the second sequence.
resultSelector
A function to create a result element from two matching elements.
public static
Collections.​Generic.​IEnumerable<​TResult>
LeftJoin​(Collections.​Generic.​IEnumerable<​TOuter> outer,
Collections.​Generic.​IEnumerable<​TInner> inner,
Func<​TOuter, TKey> outerKeySelector,
Func<​TInner, TKey> innerKeySelector,
Func<​TOuter, TInner, TResult> resultSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Correlates the elements of two sequences based on matching keys. A specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> is used to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has elements of type <typeparamref name="TResult" /> that are obtained by performing a left outer join on two sequences.
outer
The first sequence to join.
inner
The sequence to join to the first sequence.
outerKeySelector
A function to extract the join key from each element of the first sequence.
innerKeySelector
A function to extract the join key from each element of the second sequence.
resultSelector
A function to create a result element from two matching elements.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to hash and compare keys.
public static
long
LongCount​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns an <see cref="T:System.Int64" /> that represents the total number of elements in a sequence.
Returns The number of elements in the source sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements to be counted.
public static
long
LongCount​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns an <see cref="T:System.Int64" /> that represents how many elements in a sequence satisfy a condition.
Returns A number that represents how many elements in the sequence satisfy the condition in the predicate function.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements to be counted.
predicate
A function to test each element for a condition.
public static
decimal
Max​(Collections.​Generic.​IEnumerable<​decimal> source)
Returns the maximum value in a sequence of <see cref="T:System.Decimal" /> values.
Returns The maximum value in the sequence.
source
A sequence of <see cref="T:System.Decimal" /> values to determine the maximum value of.
public static
double
Max​(Collections.​Generic.​IEnumerable<​double> source)
Returns the maximum value in a sequence of <see cref="T:System.Double" /> values.
Returns The maximum value in the sequence.
source
A sequence of <see cref="T:System.Double" /> values to determine the maximum value of.
public static
int
Max​(Collections.​Generic.​IEnumerable<​int> source)
Returns the maximum value in a sequence of <see cref="T:System.Int32" /> values.
Returns The maximum value in the sequence.
source
A sequence of <see cref="T:System.Int32" /> values to determine the maximum value of.
public static
long
Max​(Collections.​Generic.​IEnumerable<​long> source)
Returns the maximum value in a sequence of <see cref="T:System.Int64" /> values.
Returns The maximum value in the sequence.
source
A sequence of <see cref="T:System.Int64" /> values to determine the maximum value of.
public static
decimal?
Max​(Collections.​Generic.​IEnumerable<​decimal?> source)
Returns the maximum value in a sequence of nullable <see cref="T:System.Decimal" /> values.
Returns A value of type <c>Nullable<Decimal></c> in C# or <c>Nullable(Of Decimal)</c> in Visual Basic that corresponds to the maximum value in the sequence.
source
A sequence of nullable <see cref="T:System.Decimal" /> values to determine the maximum value of.
public static
double?
Max​(Collections.​Generic.​IEnumerable<​double?> source)
Returns the maximum value in a sequence of nullable <see cref="T:System.Double" /> values.
Returns A value of type <c>Nullable<Double></c> in C# or <c>Nullable(Of Double)</c> in Visual Basic that corresponds to the maximum value in the sequence.
source
A sequence of nullable <see cref="T:System.Double" /> values to determine the maximum value of.
public static
int?
Max​(Collections.​Generic.​IEnumerable<​int?> source)
Returns the maximum value in a sequence of nullable <see cref="T:System.Int32" /> values.
Returns A value of type <c>Nullable<Int32></c> in C# or <c>Nullable(Of Int32)</c> in Visual Basic that corresponds to the maximum value in the sequence.
source
A sequence of nullable <see cref="T:System.Int32" /> values to determine the maximum value of.
public static
long?
Max​(Collections.​Generic.​IEnumerable<​long?> source)
Returns the maximum value in a sequence of nullable <see cref="T:System.Int64" /> values.
Returns A value of type <c>Nullable<Int64></c> in C# or <c>Nullable(Of Int64)</c> in Visual Basic that corresponds to the maximum value in the sequence.
source
A sequence of nullable <see cref="T:System.Int64" /> values to determine the maximum value of.
public static
Single?
Max​(Collections.​Generic.​IEnumerable<​Single?> source)
Returns the maximum value in a sequence of nullable <see cref="T:System.Single" /> values.
Returns A value of type <c>Nullable<Single></c> in C# or <c>Nullable(Of Single)</c> in Visual Basic that corresponds to the maximum value in the sequence.
source
A sequence of nullable <see cref="T:System.Single" /> values to determine the maximum value of.
public static
Single
Max​(Collections.​Generic.​IEnumerable<​Single> source)
Returns the maximum value in a sequence of <see cref="T:System.Single" /> values.
Returns The maximum value in the sequence.
source
A sequence of <see cref="T:System.Single" /> values to determine the maximum value of.
public static
TSource
MaxBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Returns the maximum value in a generic sequence according to a specified key selector function.
Returns The value with the maximum key in the sequence.
source
A sequence of values to determine the maximum value of.
keySelector
A function to extract the key for each element.
public static
TSource
MaxBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IComparer?<​TKey> comparer)
Returns the maximum value in a generic sequence according to a specified key selector function and key comparer.
Returns The value with the maximum key in the sequence.
source
A sequence of values to determine the maximum value of.
keySelector
A function to extract the key for each element.
comparer
The <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.
public static
TSource
Max​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the maximum value in a generic sequence.
Returns The maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
public static
TSource
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Collections.​Generic.​IComparer?<​TSource> comparer)
Returns the maximum value in a generic sequence.
Returns The maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
comparer
The <see cref="T:System.Collections.Generic.IComparer`1" /> to compare values.
public static
decimal
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, decimal> selector)
Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Decimal" /> value.
Returns The maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
double
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, double> selector)
Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Double" /> value.
Returns The maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
int
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int> selector)
Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int32" /> value.
Returns The maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
long
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, long> selector)
Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int64" /> value.
Returns The maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
decimal?
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, decimal?> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Decimal" /> value.
Returns The value of type <c>Nullable<Decimal></c> in C# or <c>Nullable(Of Decimal)</c> in Visual Basic that corresponds to the maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
double?
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, double?> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Double" /> value.
Returns The value of type <c>Nullable<Double></c> in C# or <c>Nullable(Of Double)</c> in Visual Basic that corresponds to the maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
int?
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int?> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int32" /> value.
Returns The value of type <c>Nullable<Int32></c> in C# or <c>Nullable(Of Int32)</c> in Visual Basic that corresponds to the maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
long?
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, long?> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int64" /> value.
Returns The value that corresponds to the maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
Single?
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Single?> selector)
Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Single" /> value.
Returns The value that corresponds to the maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
Single
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Single> selector)
Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Single" /> value.
Returns The maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
TResult
Max​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TResult> selector)
Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.
Returns The maximum value in the sequence.
source
A sequence of values to determine the maximum value of.
selector
A transform function to apply to each element.
public static
decimal
Min​(Collections.​Generic.​IEnumerable<​decimal> source)
Returns the minimum value in a sequence of <see cref="T:System.Decimal" /> values.
Returns The minimum value in the sequence.
source
A sequence of <see cref="T:System.Decimal" /> values to determine the minimum value of.
public static
double
Min​(Collections.​Generic.​IEnumerable<​double> source)
Returns the minimum value in a sequence of <see cref="T:System.Double" /> values.
Returns The minimum value in the sequence.
source
A sequence of <see cref="T:System.Double" /> values to determine the minimum value of.
public static
int
Min​(Collections.​Generic.​IEnumerable<​int> source)
Returns the minimum value in a sequence of <see cref="T:System.Int32" /> values.
Returns The minimum value in the sequence.
source
A sequence of <see cref="T:System.Int32" /> values to determine the minimum value of.
public static
long
Min​(Collections.​Generic.​IEnumerable<​long> source)
Returns the minimum value in a sequence of <see cref="T:System.Int64" /> values.
Returns The minimum value in the sequence.
source
A sequence of <see cref="T:System.Int64" /> values to determine the minimum value of.
public static
decimal?
Min​(Collections.​Generic.​IEnumerable<​decimal?> source)
Returns the minimum value in a sequence of nullable <see cref="T:System.Decimal" /> values.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of nullable <see cref="T:System.Decimal" /> values to determine the minimum value of.
public static
double?
Min​(Collections.​Generic.​IEnumerable<​double?> source)
Returns the minimum value in a sequence of nullable <see cref="T:System.Double" /> values.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of nullable <see cref="T:System.Double" /> values to determine the minimum value of.
public static
int?
Min​(Collections.​Generic.​IEnumerable<​int?> source)
Returns the minimum value in a sequence of nullable <see cref="T:System.Int32" /> values.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of nullable <see cref="T:System.Int32" /> values to determine the minimum value of.
public static
long?
Min​(Collections.​Generic.​IEnumerable<​long?> source)
Returns the minimum value in a sequence of nullable <see cref="T:System.Int64" /> values.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of nullable <see cref="T:System.Int64" /> values to determine the minimum value of.
public static
Single?
Min​(Collections.​Generic.​IEnumerable<​Single?> source)
Returns the minimum value in a sequence of nullable <see cref="T:System.Single" /> values.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of nullable <see cref="T:System.Single" /> values to determine the minimum value of.
public static
Single
Min​(Collections.​Generic.​IEnumerable<​Single> source)
Returns the minimum value in a sequence of <see cref="T:System.Single" /> values.
Returns The minimum value in the sequence.
source
A sequence of <see cref="T:System.Single" /> values to determine the minimum value of.
public static
TSource
MinBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Returns the minimum value in a generic sequence according to a specified key selector function.
Returns The value with the minimum key in the sequence.
source
A sequence of values to determine the minimum value of.
keySelector
A function to extract the key for each element.
public static
TSource
MinBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IComparer?<​TKey> comparer)
Returns the minimum value in a generic sequence according to a specified key selector function and key comparer.
Returns The value with the minimum key in the sequence.
source
A sequence of values to determine the minimum value of.
keySelector
A function to extract the key for each element.
comparer
The <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.
public static
TSource
Min​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the minimum value in a generic sequence.
Returns The minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
public static
TSource
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Collections.​Generic.​IComparer?<​TSource> comparer)
Returns the minimum value in a generic sequence.
Returns The minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
comparer
The <see cref="T:System.Collections.Generic.IComparer`1" /> to compare values.
public static
decimal
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, decimal> selector)
Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Decimal" /> value.
Returns The minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
double
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, double> selector)
Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Double" /> value.
Returns The minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
int
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int> selector)
Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int32" /> value.
Returns The minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
long
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, long> selector)
Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int64" /> value.
Returns The minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
decimal?
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, decimal?> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Decimal" /> value.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
double?
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, double?> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Double" /> value.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
int?
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int?> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int32" /> value.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
long?
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, long?> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int64" /> value.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
Single?
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Single?> selector)
Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Single" /> value.
Returns The value that corresponds to the minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
Single
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Single> selector)
Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Single" /> value.
Returns The minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
TResult
Min​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TResult> selector)
Invokes a transform function on each element of a generic sequence and returns the minimum resulting value.
Returns The minimum value in the sequence.
source
A sequence of values to determine the minimum value of.
selector
A transform function to apply to each element.
public static
Collections.​Generic.​IEnumerable<​TResult>
OfType​(Collections.​IEnumerable source)
Filters the elements of an <see cref="T:System.Collections.IEnumerable" /> based on a specified type.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements from the input sequence of type <typeparamref name="TResult" /> .
source
The <see cref="T:System.Collections.IEnumerable" /> whose elements to filter.
public static
IOrderedEnumerable<​TSource>
OrderByDescending​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Sorts the elements of a sequence in descending order according to a key.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted in descending order according to a key.
source
A sequence of values to order.
keySelector
A function to extract a key from an element.
public static
IOrderedEnumerable<​TSource>
OrderByDescending​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IComparer?<​TKey> comparer)
Sorts the elements of a sequence in descending order by using a specified comparer.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted in descending order according to a key.
source
A sequence of values to order.
keySelector
A function to extract a key from an element.
comparer
An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.
public static
IOrderedEnumerable<​TSource>
OrderBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Sorts the elements of a sequence in ascending order according to a key.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.
source
A sequence of values to order.
keySelector
A function to extract a key from an element.
public static
IOrderedEnumerable<​TSource>
OrderBy​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IComparer?<​TKey> comparer)
Sorts the elements of a sequence in ascending order by using a specified comparer.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.
source
A sequence of values to order.
keySelector
A function to extract a key from an element.
comparer
An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.
public static
IOrderedEnumerable<​T>
OrderDescending​(Collections.​Generic.​IEnumerable<​T> source)
Sorts the elements of a sequence in descending order.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted.
source
A sequence of values to order.
public static
IOrderedEnumerable<​T>
OrderDescending​(Collections.​Generic.​IEnumerable<​T> source,
Collections.​Generic.​IComparer?<​T> comparer)
Sorts the elements of a sequence in descending order.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted.
source
A sequence of values to order.
comparer
An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.
public static
IOrderedEnumerable<​T>
Order​(Collections.​Generic.​IEnumerable<​T> source)
Sorts the elements of a sequence in ascending order.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted.
source
A sequence of values to order.
public static
IOrderedEnumerable<​T>
Order​(Collections.​Generic.​IEnumerable<​T> source,
Collections.​Generic.​IComparer?<​T> comparer)
Sorts the elements of a sequence in ascending order.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted.
source
A sequence of values to order.
comparer
An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.
public static
Collections.​Generic.​IEnumerable<​TSource>
Prepend​(Collections.​Generic.​IEnumerable<​TSource> source,
TSource element)
Adds a value to the beginning of the sequence.
Returns A new sequence that begins with <paramref name="element" /> .
source
A sequence of values.
element
The value to prepend to <paramref name="source" /> .
public static
Collections.​Generic.​IEnumerable<​int>
Range​(int start,
int count)
Generates a sequence of integral numbers within a specified range.
Returns An <c>IEnumerable<Int32></c> in C# or <c>IEnumerable(Of Int32)</c> in Visual Basic that contains a range of sequential integral numbers.
start
The value of the first integer in the sequence.
count
The number of sequential integers to generate.
public static
Collections.​Generic.​IEnumerable<​TResult>
Repeat​(TResult element,
int count)
Generates a sequence that contains one repeated value.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains a repeated value.
element
The value to be repeated.
count
The number of times to repeat the value in the generated sequence.
public static
Collections.​Generic.​IEnumerable<​TSource>
Reverse​(Collections.​Generic.​IEnumerable<​TSource> source)
Inverts the order of the elements in a sequence.
Returns A sequence whose elements correspond to those of the input sequence in reverse order.
source
A sequence of values to reverse.
public static
Collections.​Generic.​IEnumerable<​TSource>
Reverse​(TSource[] source)
public static
Collections.​Generic.​IEnumerable<​TResult>
RightJoin​(Collections.​Generic.​IEnumerable<​TOuter> outer,
Collections.​Generic.​IEnumerable<​TInner> inner,
Func<​TOuter, TKey> outerKeySelector,
Func<​TInner, TKey> innerKeySelector,
Func<​TOuter, TInner, TResult> resultSelector)
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has elements of type <typeparamref name="TResult" /> that are obtained by performing a right outer join on two sequences.
outer
The first sequence to join.
inner
The sequence to join to the first sequence.
outerKeySelector
A function to extract the join key from each element of the first sequence.
innerKeySelector
A function to extract the join key from each element of the second sequence.
resultSelector
A function to create a result element from two matching elements.
public static
Collections.​Generic.​IEnumerable<​TResult>
RightJoin​(Collections.​Generic.​IEnumerable<​TOuter> outer,
Collections.​Generic.​IEnumerable<​TInner> inner,
Func<​TOuter, TKey> outerKeySelector,
Func<​TInner, TKey> innerKeySelector,
Func<​TOuter, TInner, TResult> resultSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Correlates the elements of two sequences based on matching keys. A specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> is used to compare keys.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has elements of type <typeparamref name="TResult" /> that are obtained by performing a right outer join on two sequences.
outer
The first sequence to join.
inner
The sequence to join to the first sequence.
outerKeySelector
A function to extract the join key from each element of the first sequence.
innerKeySelector
A function to extract the join key from each element of the second sequence.
resultSelector
A function to create a result element from two matching elements.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to hash and compare keys.
public static
Collections.​Generic.​IEnumerable<​TResult>
SelectMany​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Collections.​Generic.​IEnumerable<​TResult>> selector)
Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> and flattens the resulting sequences into one sequence.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
source
A sequence of values to project.
selector
A transform function to apply to each element.
public static
Collections.​Generic.​IEnumerable<​TResult>
SelectMany​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int, Collections.​Generic.​IEnumerable<​TResult>> selector)
Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> , and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the one-to-many transform function on each element of an input sequence.
source
A sequence of values to project.
selector
A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
public static
Collections.​Generic.​IEnumerable<​TResult>
SelectMany​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Collections.​Generic.​IEnumerable<​TCollection>> collectionSelector,
Func<​TSource, TCollection, TResult> resultSelector)
Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> , flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the one-to-many transform function <paramref name="collectionSelector" /> on each element of <paramref name="source" /> and then mapping each of those sequence elements and their corresponding source element to a result element.
source
A sequence of values to project.
collectionSelector
A transform function to apply to each element of the input sequence.
resultSelector
A transform function to apply to each element of the intermediate sequence.
public static
Collections.​Generic.​IEnumerable<​TResult>
SelectMany​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int, Collections.​Generic.​IEnumerable<​TCollection>> collectionSelector,
Func<​TSource, TCollection, TResult> resultSelector)
Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> , flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the one-to-many transform function <paramref name="collectionSelector" /> on each element of <paramref name="source" /> and then mapping each of those sequence elements and their corresponding source element to a result element.
source
A sequence of values to project.
collectionSelector
A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
resultSelector
A transform function to apply to each element of the intermediate sequence.
public static
Collections.​Generic.​IEnumerable<​TResult>
Select​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int, TResult> selector)
Projects each element of a sequence into a new form by incorporating the element's index.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the transform function on each element of <paramref name="source" /> .
source
A sequence of values to invoke a transform function on.
selector
A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
public static
Collections.​Generic.​IEnumerable<​TResult>
Select​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TResult> selector)
Projects each element of a sequence into a new form.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the transform function on each element of <paramref name="source" /> .
source
A sequence of values to invoke a transform function on.
selector
A transform function to apply to each element.
public static
Collections.​Generic.​IEnumerable<​T>
Sequence​(T start,
T endInclusive,
T step)
Generates a sequence that begins with <paramref name="start" /> and yields additional values each incremented by <paramref name="step" /> until <paramref name="endInclusive" /> is reached.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the sequence.
start
The starting value. This value will always be included in the resulting sequence.
endInclusive
The ending bound beyond which values will not be included in the sequence.
step
The amount by which the next value in the sequence should be incremented from the previous value.
public static
bool
SequenceEqual​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second)
Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.
Returns <see langword="true" /> if the two source sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type; otherwise, <see langword="false" /> .
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to compare to <paramref name="second" /> .
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to compare to the first sequence.
public static
bool
SequenceEqual​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second,
Collections.​Generic.​IEqualityComparer?<​TSource> comparer)
Determines whether two sequences are equal by comparing their elements by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> .
Returns <see langword="true" /> if the two source sequences are of equal length and their corresponding elements compare equal according to <paramref name="comparer" /> ; otherwise, <see langword="false" /> .
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to compare to <paramref name="second" /> .
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to compare to the first sequence.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to use to compare elements.
public static
Collections.​Generic.​IEnumerable<​TSource>
Shuffle​(Collections.​Generic.​IEnumerable<​TSource> source)
Shuffles the order of the elements of a sequence.
Returns A sequence whose elements correspond to those of the input sequence in randomized order.
source
A sequence of values to shuffle.
public static
TSource
SingleOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source)
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.
Returns The single element of the input sequence, or <see langword="default" /> ( <typeparamref name="TSource" /> ) if the sequence contains no elements.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the single element of.
public static
TSource
SingleOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
TSource defaultValue)
Returns the only element of a sequence, or a specified default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
Returns The single element of the input sequence, or <paramref name="defaultValue" /> if the sequence contains no elements.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the single element of.
defaultValue
The default value to return if the sequence is empty.
public static
TSource
SingleOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.
Returns The single element of the input sequence that satisfies the condition, or <see langword="default" /> ( <typeparamref name="TSource" /> ) if no such element is found.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return a single element from.
predicate
A function to test an element for a condition.
public static
TSource
SingleOrDefault​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate,
TSource defaultValue)
Returns the only element of a sequence that satisfies a specified condition, or a specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition.
Returns The single element of the input sequence that satisfies the condition, or <paramref name="defaultValue" /> if no such element is found.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return a single element from.
predicate
A function to test an element for a condition.
defaultValue
The default value to return if the sequence is empty.
public static
TSource
Single​(Collections.​Generic.​IEnumerable<​TSource> source)
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
Returns The single element of the input sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the single element of.
public static
TSource
Single​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.
Returns The single element of the input sequence that satisfies a condition.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return a single element from.
predicate
A function to test an element for a condition.
public static
Collections.​Generic.​IEnumerable<​TSource>
SkipLast​(Collections.​Generic.​IEnumerable<​TSource> source,
int count)
Returns a new enumerable collection that contains the elements from <paramref name="source" /> with the last <paramref name="count" /> elements of the source collection omitted.
Returns A new enumerable collection that contains the elements from <paramref name="source" /> minus <paramref name="count" /> elements from the end of the collection.
source
An enumerable collection instance.
count
The number of elements to omit from the end of the collection.
public static
Collections.​Generic.​IEnumerable<​TSource>
SkipWhile​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by <paramref name="predicate" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return elements from.
predicate
A function to test each element for a condition.
public static
Collections.​Generic.​IEnumerable<​TSource>
SkipWhile​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int, bool> predicate)
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by <paramref name="predicate" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return elements from.
predicate
A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
public static
Collections.​Generic.​IEnumerable<​TSource>
Skip​(Collections.​Generic.​IEnumerable<​TSource> source,
int count)
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements that occur after the specified index in the input sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return elements from.
count
The number of elements to skip before returning the remaining elements.
public static
decimal
Sum​(Collections.​Generic.​IEnumerable<​decimal> source)
Computes the sum of a sequence of <see cref="T:System.Decimal" /> values.
Returns The sum of the values in the sequence.
source
A sequence of <see cref="T:System.Decimal" /> values to calculate the sum of.
public static
double
Sum​(Collections.​Generic.​IEnumerable<​double> source)
Computes the sum of a sequence of <see cref="T:System.Double" /> values.
Returns The sum of the values in the sequence.
source
A sequence of <see cref="T:System.Double" /> values to calculate the sum of.
public static
int
Sum​(Collections.​Generic.​IEnumerable<​int> source)
Computes the sum of a sequence of <see cref="T:System.Int32" /> values.
Returns The sum of the values in the sequence.
source
A sequence of <see cref="T:System.Int32" /> values to calculate the sum of.
public static
long
Sum​(Collections.​Generic.​IEnumerable<​long> source)
Computes the sum of a sequence of <see cref="T:System.Int64" /> values.
Returns The sum of the values in the sequence.
source
A sequence of <see cref="T:System.Int64" /> values to calculate the sum of.
public static
decimal?
Sum​(Collections.​Generic.​IEnumerable<​decimal?> source)
Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values.
Returns The sum of the values in the sequence.
source
A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the sum of.
public static
double?
Sum​(Collections.​Generic.​IEnumerable<​double?> source)
Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values.
Returns The sum of the values in the sequence.
source
A sequence of nullable <see cref="T:System.Double" /> values to calculate the sum of.
public static
int?
Sum​(Collections.​Generic.​IEnumerable<​int?> source)
Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values.
Returns The sum of the values in the sequence.
source
A sequence of nullable <see cref="T:System.Int32" /> values to calculate the sum of.
public static
long?
Sum​(Collections.​Generic.​IEnumerable<​long?> source)
Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values.
Returns The sum of the values in the sequence.
source
A sequence of nullable <see cref="T:System.Int64" /> values to calculate the sum of.
public static
Single?
Sum​(Collections.​Generic.​IEnumerable<​Single?> source)
Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values.
Returns The sum of the values in the sequence.
source
A sequence of nullable <see cref="T:System.Single" /> values to calculate the sum of.
public static
Single
Sum​(Collections.​Generic.​IEnumerable<​Single> source)
Computes the sum of a sequence of <see cref="T:System.Single" /> values.
Returns The sum of the values in the sequence.
source
A sequence of <see cref="T:System.Single" /> values to calculate the sum of.
public static
decimal
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, decimal> selector)
Computes the sum of the sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
double
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, double> selector)
Computes the sum of the sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
int
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int> selector)
Computes the sum of the sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
long
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, long> selector)
Computes the sum of the sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
decimal?
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, decimal?> selector)
Computes the sum of the sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
double?
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, double?> selector)
Computes the sum of the sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
int?
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int?> selector)
Computes the sum of the sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
long?
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, long?> selector)
Computes the sum of the sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
Single?
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Single?> selector)
Computes the sum of the sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
Single
Sum​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, Single> selector)
Computes the sum of the sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
Returns The sum of the projected values.
source
A sequence of values that are used to calculate a sum.
selector
A transform function to apply to each element.
public static
Collections.​Generic.​IEnumerable<​TSource>
TakeLast​(Collections.​Generic.​IEnumerable<​TSource> source,
int count)
Returns a new enumerable collection that contains the last <paramref name="count" /> elements from <paramref name="source" /> .
Returns A new enumerable collection that contains the last <paramref name="count" /> elements from <paramref name="source" /> .
source
An enumerable collection instance.
count
The number of elements to take from the end of the collection.
public static
Collections.​Generic.​IEnumerable<​TSource>
TakeWhile​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Returns elements from a sequence as long as a specified condition is true.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from the input sequence that occur before the element at which the test no longer passes.
source
A sequence to return elements from.
predicate
A function to test each element for a condition.
public static
Collections.​Generic.​IEnumerable<​TSource>
TakeWhile​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int, bool> predicate)
Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements from the input sequence that occur before the element at which the test no longer passes.
source
The sequence to return elements from.
predicate
A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
public static
Collections.​Generic.​IEnumerable<​TSource>
Take​(Collections.​Generic.​IEnumerable<​TSource> source,
int count)
Returns a specified number of contiguous elements from the start of a sequence.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the specified number of elements from the start of the input sequence.
source
The sequence to return elements from.
count
The number of elements to return.
public static
Collections.​Generic.​IEnumerable<​TSource>
Take​(Collections.​Generic.​IEnumerable<​TSource> source,
Range range)
Returns a specified range of contiguous elements from a sequence.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the specified range of elements from the <paramref name="source" /> sequence.
source
The sequence to return elements from.
range
The range of elements to return, which has start and end indexes either from the beginning or the end of the sequence.
public static
IOrderedEnumerable<​TSource>
ThenByDescending​(IOrderedEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted in descending order according to a key.
source
An <see cref="T:System.Linq.IOrderedEnumerable`1" /> that contains elements to sort.
keySelector
A function to extract a key from each element.
public static
IOrderedEnumerable<​TSource>
ThenByDescending​(IOrderedEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IComparer?<​TKey> comparer)
Performs a subsequent ordering of the elements in a sequence in descending order by using a specified comparer.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted in descending order according to a key.
source
An <see cref="T:System.Linq.IOrderedEnumerable`1" /> that contains elements to sort.
keySelector
A function to extract a key from each element.
comparer
An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.
public static
IOrderedEnumerable<​TSource>
ThenBy​(IOrderedEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.
source
An <see cref="T:System.Linq.IOrderedEnumerable`1" /> that contains elements to sort.
keySelector
A function to extract a key from each element.
public static
IOrderedEnumerable<​TSource>
ThenBy​(IOrderedEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IComparer?<​TKey> comparer)
Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer.
Returns An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.
source
An <see cref="T:System.Linq.IOrderedEnumerable`1" /> that contains elements to sort.
keySelector
A function to extract a key from each element.
comparer
An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.
public static
TSource[]
ToArray​(Collections.​Generic.​IEnumerable<​TSource> source)
Creates an array from a <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
Returns An array that contains the elements from the input sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create an array from.
public static
Collections.​Generic.​Dictionary<​TKey, TValue>
ToDictionary​(Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​TKey, TValue>> source)
Creates a dictionary from an enumeration according to the default comparer for the key type.
Returns A dictionary that contains keys and values from <paramref name="source" /> and uses the default comparer for the key type.
source
The enumeration to create a dictionary from.
public static
Collections.​Generic.​Dictionary<​TKey, TValue>
ToDictionary​(Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​TKey, TValue>> source,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Creates a dictionary from an enumeration according to specified key comparer.
Returns A dictionary that contains keys and values from <paramref name="source" /> .
source
The enumeration to create a dictionary from.
comparer
An equality comparer to compare keys.
public static
Collections.​Generic.​Dictionary<​TKey, TValue>
ToDictionary​(Collections.​Generic.​IEnumerable<​ValueTuple<​TKey, TValue>> source)
Creates a dictionary from an enumeration according to the default comparer for the key type.
Returns A dictionary that contains keys and values from <paramref name="source" /> and uses default comparer for the key type.
source
The enumeration to create a dictionary from.
public static
Collections.​Generic.​Dictionary<​TKey, TValue>
ToDictionary​(Collections.​Generic.​IEnumerable<​ValueTuple<​TKey, TValue>> source,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Creates a dictionary from an enumeration according to specified key equality comparer.
Returns A dictionary that contains keys and values from <paramref name="source" /> .
source
The enumeration to create a dictionary from.
comparer
An equality comparer to compare keys.
public static
Collections.​Generic.​Dictionary<​TKey, TSource>
ToDictionary​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Creates a <see cref="T:System.Collections.Generic.Dictionary`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function.
Returns A <see cref="T:System.Collections.Generic.Dictionary`2" /> that contains keys and values. The values within each group are in the same order as in <paramref name="source" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.Dictionary`2" /> from.
keySelector
A function to extract a key from each element.
public static
Collections.​Generic.​Dictionary<​TKey, TSource>
ToDictionary​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Creates a <see cref="T:System.Collections.Generic.Dictionary`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function and key comparer.
Returns A <see cref="T:System.Collections.Generic.Dictionary`2" /> that contains keys and values. The values within each group are in the same order as in <paramref name="source" /> .
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.Dictionary`2" /> from.
keySelector
A function to extract a key from each element.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
Collections.​Generic.​Dictionary<​TKey, TElement>
ToDictionary​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TSource, TElement> elementSelector)
Creates a <see cref="T:System.Collections.Generic.Dictionary`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to specified key selector and element selector functions.
Returns A <see cref="T:System.Collections.Generic.Dictionary`2" /> that contains values of type <typeparamref name="TElement" /> selected from the input sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.Dictionary`2" /> from.
keySelector
A function to extract a key from each element.
elementSelector
A transform function to produce a result element value from each element.
public static
Collections.​Generic.​Dictionary<​TKey, TElement>
ToDictionary​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TSource, TElement> elementSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Creates a <see cref="T:System.Collections.Generic.Dictionary`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function, a comparer, and an element selector function.
Returns A <see cref="T:System.Collections.Generic.Dictionary`2" /> that contains values of type <typeparamref name="TElement" /> selected from the input sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.Dictionary`2" /> from.
keySelector
A function to extract a key from each element.
elementSelector
A transform function to produce a result element value from each element.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
Collections.​Generic.​HashSet<​TSource>
ToHashSet​(Collections.​Generic.​IEnumerable<​TSource> source)
Creates a <see cref="T:System.Collections.Generic.HashSet`1" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
Returns A <see cref="T:System.Collections.Generic.HashSet`1" /> that contains values of type <typeparamref name="TSource" /> selected from the input sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.HashSet`1" /> from.
public static
Collections.​Generic.​HashSet<​TSource>
ToHashSet​(Collections.​Generic.​IEnumerable<​TSource> source,
Collections.​Generic.​IEqualityComparer?<​TSource> comparer)
Creates a <see cref="T:System.Collections.Generic.HashSet`1" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> using the <paramref name="comparer" /> to compare keys.
Returns A <see cref="T:System.Collections.Generic.HashSet`1" /> that contains values of type <typeparamref name="TSource" /> selected from the input sequence.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.HashSet`1" /> from.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
Collections.​Generic.​List<​TSource>
ToList​(Collections.​Generic.​IEnumerable<​TSource> source)
Creates a <see cref="T:System.Collections.Generic.List`1" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
Returns A <see cref="T:System.Collections.Generic.List`1" /> that contains elements from the input sequence.
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.List`1" /> from.
public static
ILookup<​TKey, TSource>
ToLookup​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector)
Creates a <see cref="T:System.Linq.Lookup`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function.
Returns A <see cref="T:System.Linq.Lookup`2" /> that contains keys and values. The values within each group are in the same order as in <paramref name="source" /> .
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Linq.Lookup`2" /> from.
keySelector
A function to extract a key from each element.
public static
ILookup<​TKey, TSource>
ToLookup​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Creates a <see cref="T:System.Linq.Lookup`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function and key comparer.
Returns A <see cref="T:System.Linq.Lookup`2" /> that contains keys and values. The values within each group are in the same order as in <paramref name="source" /> .
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Linq.Lookup`2" /> from.
keySelector
A function to extract a key from each element.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
ILookup<​TKey, TElement>
ToLookup​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TSource, TElement> elementSelector)
Creates a <see cref="T:System.Linq.Lookup`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to specified key selector and element selector functions.
Returns A <see cref="T:System.Linq.Lookup`2" /> that contains values of type <typeparamref name="TElement" /> selected from the input sequence.
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Linq.Lookup`2" /> from.
keySelector
A function to extract a key from each element.
elementSelector
A transform function to produce a result element value from each element.
public static
ILookup<​TKey, TElement>
ToLookup​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, TKey> keySelector,
Func<​TSource, TElement> elementSelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Creates a <see cref="T:System.Linq.Lookup`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function, a comparer and an element selector function.
Returns A <see cref="T:System.Linq.Lookup`2" /> that contains values of type <typeparamref name="TElement" /> selected from the input sequence.
source
The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Linq.Lookup`2" /> from.
keySelector
A function to extract a key from each element.
elementSelector
A transform function to produce a result element value from each element.
comparer
An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.
public static
bool
TryGetNonEnumeratedCount​(Collections.​Generic.​IEnumerable<​TSource> source,
Int32& count)
public static
Collections.​Generic.​IEnumerable<​TSource>
UnionBy​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second,
Func<​TSource, TKey> keySelector)
Produces the set union of two sequences according to a specified key selector function.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from both input sequences, excluding duplicates.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the first set for the union.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the second set for the union.
keySelector
A function to extract the key for each element.
public static
Collections.​Generic.​IEnumerable<​TSource>
UnionBy​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second,
Func<​TSource, TKey> keySelector,
Collections.​Generic.​IEqualityComparer?<​TKey> comparer)
Produces the set union of two sequences according to a specified key selector function.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from both input sequences, excluding duplicates.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the first set for the union.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the second set for the union.
keySelector
A function to extract the key for each element.
comparer
The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
public static
Collections.​Generic.​IEnumerable<​TSource>
Union​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second)
Produces the set union of two sequences by using the default equality comparer.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from both input sequences, excluding duplicates.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the first set for the union.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the second set for the union.
public static
Collections.​Generic.​IEnumerable<​TSource>
Union​(Collections.​Generic.​IEnumerable<​TSource> first,
Collections.​Generic.​IEnumerable<​TSource> second,
Collections.​Generic.​IEqualityComparer?<​TSource> comparer)
Produces the set union of two sequences by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> .
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from both input sequences, excluding duplicates.
first
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the first set for the union.
second
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the second set for the union.
comparer
The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.
public static
Collections.​Generic.​IEnumerable<​TSource>
Where​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, bool> predicate)
Filters a sequence of values based on a predicate.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements from the input sequence that satisfy the condition.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to filter.
predicate
A function to test each element for a condition.
public static
Collections.​Generic.​IEnumerable<​TSource>
Where​(Collections.​Generic.​IEnumerable<​TSource> source,
Func<​TSource, int, bool> predicate)
Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements from the input sequence that satisfy the condition.
source
An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to filter.
predicate
A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
public static
Collections.​Generic.​IEnumerable<​ValueTuple<​TFirst, TSecond>>
Zip​(Collections.​Generic.​IEnumerable<​TFirst> first,
Collections.​Generic.​IEnumerable<​TSecond> second)
Produces a sequence of tuples with elements from the two specified sequences.
Returns A sequence of tuples with elements taken from the first and second sequences, in that order.
first
The first sequence to merge.
second
The second sequence to merge.
public static
Collections.​Generic.​IEnumerable<​ValueTuple<​TFirst, TSecond, TThird>>
Zip​(Collections.​Generic.​IEnumerable<​TFirst> first,
Collections.​Generic.​IEnumerable<​TSecond> second,
Collections.​Generic.​IEnumerable<​TThird> third)
Produces a sequence of tuples with elements from the three specified sequences.
Returns A sequence of tuples with elements taken from the first, second, and third sequences, in that order.
first
The first sequence to merge.
second
The second sequence to merge.
third
The third sequence to merge.
public static
Collections.​Generic.​IEnumerable<​TResult>
Zip​(Collections.​Generic.​IEnumerable<​TFirst> first,
Collections.​Generic.​IEnumerable<​TSecond> second,
Func<​TFirst, TSecond, TResult> resultSelector)
Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
Returns An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains merged elements of two input sequences.
first
The first sequence to merge.
second
The second sequence to merge.
resultSelector
A function that specifies how to merge the elements from the two sequences.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object