Class EnumerableExtensions
LINQ-inspired extension methods for
Inheritance
Namespace: X10D.Linq
Assembly: X10D.dll
Syntax
public static class EnumerableExtensions : object
Methods
| Improve this Doc View SourceExcept<TSource>(IEnumerable<TSource>, TSource)
Filters a sequence of values by omitting elements that match a specified value.
Declaration
public static IEnumerable<TSource> Except<TSource>(this IEnumerable<TSource> source, TSource item)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TSource> | source | An |
TSource | item | The value to omit. |
Returns
Type | Description |
---|---|
IEnumerable<TSource> | An |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
MinMax<T>(IEnumerable<T>)
Returns the minimum and maximum values in a sequence of values.
Declaration
public static (T Minimum, T Maximum) MinMax<T>(this IEnumerable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | A sequence of values to determine the minimum and maximum values of. |
Returns
Type | Description |
---|---|
System.ValueTuple<T, T> | A tuple containing the minimum and maximum values in |
Type Parameters
Name | Description |
---|---|
T | The type of the elements in |
MinMax<T>(IEnumerable<T>, Nullable<IComparer<T>>)
Returns the minimum and maximum values in a sequence of values, using a specified comparer.
Declaration
public static (T Minimum, T Maximum) MinMax<T>(this IEnumerable<T> source, IComparer<T>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | A sequence of values to determine the minimum and maximum values of. |
System.Nullable<IComparer<T>> | comparer | The comparer which shall be used to compare each element in the sequence. |
Returns
Type | Description |
---|---|
System.ValueTuple<T, T> | A tuple containing the minimum and maximum values in |
Type Parameters
Name | Description |
---|---|
T | The type of the elements in |
MinMax<TSource, TResult>(IEnumerable<TSource>, Func<TSource, TResult>)
Invokes a transform function on each element of a sequence of elements and returns the minimum and maximum values.
Declaration
public static (TResult Minimum, TResult Maximum) MinMax<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TSource> | source | A sequence of values to determine the minimum and maximum values of. |
Func<TSource, TResult> | selector | A transform function to apply to each element. |
Returns
Type | Description |
---|---|
System.ValueTuple<TResult, TResult> | A tuple containing the minimum and maximum values in |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements in |
TResult | The type of the elements to compare. |
MinMax<TSource, TResult>(IEnumerable<TSource>, Func<TSource, TResult>, Nullable<IComparer<TResult>>)
Invokes a transform function on each element of a sequence of elements and returns the minimum and maximum values, using a specified comparer.
Declaration
public static (TResult Minimum, TResult Maximum) MinMax<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, IComparer<TResult>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TSource> | source | A sequence of values to determine the minimum and maximum values of. |
Func<TSource, TResult> | selector | A transform function to apply to each element. |
System.Nullable<IComparer<TResult>> | comparer | The comparer which shall be used to compare each element in the sequence. |
Returns
Type | Description |
---|---|
System.ValueTuple<TResult, TResult> | A tuple containing the minimum and maximum values in |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements in |
TResult | The type of the elements to compare. |
MinMaxBy<TSource, TResult>(IEnumerable<TSource>, Func<TSource, TResult>)
Returns the minimum and maximum values in a sequence according to a specified key selector function.
Declaration
public static (TSource Minimum, TSource Maximum) MinMaxBy<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> keySelector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TSource> | source | A sequence of values to determine the minimum and maximum values of. |
Func<TSource, TResult> | keySelector | A function to extract the key for each element. |
Returns
Type | Description |
---|---|
System.ValueTuple<TSource, TSource> | A tuple containing the minimum and maximum values in |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements in |
TResult | The type of the elements to compare. |
MinMaxBy<TSource, TResult>(IEnumerable<TSource>, Func<TSource, TResult>, Nullable<IComparer<TResult>>)
Returns the minimum and maximum values in a sequence according to a specified key selector function.
Declaration
public static (TSource Minimum, TSource Maximum) MinMaxBy<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> keySelector, IComparer<TResult>? comparer)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TSource> | source | A sequence of values to determine the minimum and maximum values of. |
Func<TSource, TResult> | keySelector | A function to extract the key for each element. |
System.Nullable<IComparer<TResult>> | comparer | The comparer which shall be used to compare each element in the sequence. |
Returns
Type | Description |
---|---|
System.ValueTuple<TSource, TSource> | A tuple containing the minimum and maximum values in |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements in |
TResult | The type of the elements to compare. |