Class EnumerableUtility
This utility class provides a set of static methods for querying objects that implement System.Collections.Generic.IEnumerable<T>.
Inheritance
Namespace: Cuemon.Collections.Generic
Assembly: Cuemon.Core.dll
Syntax
public static class EnumerableUtility
Methods
| Improve this DocChunk<TSource>(ref IEnumerable<TSource>)
Returns a chunked System.Collections.Generic.IEnumerable<T> sequence with a maximum of 128 elements.
Declaration
public static IEnumerable<TSource> Chunk<TSource>(ref IEnumerable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | An System.Collections.Generic.IEnumerable<T> to chunk into smaller slices for a batch run or similar. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains no more than 128 elements from the |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
Remarks
The original source
is reduced equivalent to the number of elements in the returned sequence.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Chunk<TSource>(ref IEnumerable<TSource>, Int32)
Returns a chunked System.Collections.Generic.IEnumerable<T> sequence with a maximum of the specified size
. Default is 128.
Declaration
public static IEnumerable<TSource> Chunk<TSource>(ref IEnumerable<TSource> source, int size)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | An System.Collections.Generic.IEnumerable<T> to chunk into smaller slices for a batch run or similar. |
System.Int32 | size | The amount of elements to process at a time. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains no more than the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
Remarks
The original source
is reduced equivalent to the number of elements in the returned sequence.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
Concat<TSource>(IEnumerable<TSource>[])
Concatenates the specified sequences in sources
into one sequence.
Declaration
public static IEnumerable<TSource> Concat<TSource>(params IEnumerable<TSource>[] sources)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource>[] | sources | The sequences to concatenate into one System.Collections.Generic.IEnumerable<T>. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains the concatenated elements of the specified sequences in |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the input sequences of |
Contains<TSource>(IEnumerable<TSource>, TSource, IEqualityComparer<TSource>)
Determines whether a sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer<T>.
Declaration
public static bool Contains<TSource>(IEnumerable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | A sequence in which to locate a value. |
TSource | value | The value to locate in the sequence. |
System.Collections.Generic.IEqualityComparer<TSource> | comparer | An equality comparer to compare values. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Type Parameters
Name | Description |
---|---|
TSource | The type of the System.Collections.Generic.IEnumerable<T> of |
Contains<TSource>(IEnumerable<TSource>, TSource, Func<TSource, TSource, Boolean>)
Determines whether a sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer<T>.
Declaration
public static bool Contains<TSource>(IEnumerable<TSource> source, TSource value, Func<TSource, TSource, bool> condition)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | A sequence in which to locate a value. |
TSource | value | The value to locate in the sequence. |
System.Func<TSource, TSource, System.Boolean> | condition | The function delegate that will compare values from the |
Returns
Type | Description |
---|---|
System.Boolean |
|
Type Parameters
Name | Description |
---|---|
TSource | The type of the System.Collections.Generic.IEnumerable<T> of |
FindAll<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>)
Retrieves all the elements that match the conditions defined by the specified predicate.
Declaration
public static IEnumerable<TSource> FindAll<TSource>(IEnumerable<TSource> source, Func<TSource, bool> match)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
FindAll<TSource, T1, T2, T3, T4, T5, T6, T7, T8, T9>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, T4, T5, T6, T7, T8, T9, Boolean>, T1, T2, T3, T4, T5, T6, T7, T8, T9)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T1, T2, T3, T4, T5, T6, T7, T8, T9>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, T4, T5, T6, T7, T8, T9, bool> match, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T1, T2, T3, T4, T5, T6, T7, T8, T9, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
T5 | arg5 | The fifth parameter of the function delegate |
T6 | arg6 | The sixth parameter of the function delegate |
T7 | arg7 | The seventh parameter of the function delegate |
T8 | arg8 | The eighth parameter of the function delegate |
T9 | arg9 | The ninth parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
T5 | The type of the fifth parameter of the function delegate |
T6 | The type of the sixth parameter of the function delegate |
T7 | The type of the seventh parameter of the function delegate |
T8 | The type of the eighth parameter of the function delegate |
T9 | The type of the ninth parameter of the function delegate |
FindAll<TSource, T>(IEnumerable<TSource>, Func<TSource, T, Boolean>, T)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T>(IEnumerable<TSource> source, Func<TSource, T, bool> match, T arg)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T | arg | The first parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T | The type of the first parameter of the function delegate |
FindAll<TSource, T1, T2>(IEnumerable<TSource>, Func<TSource, T1, T2, Boolean>, T1, T2)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T1, T2>(IEnumerable<TSource> source, Func<TSource, T1, T2, bool> match, T1 arg1, T2 arg2)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T1, T2, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
FindAll<TSource, T1, T2, T3>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, Boolean>, T1, T2, T3)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T1, T2, T3>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, bool> match, T1 arg1, T2 arg2, T3 arg3)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T1, T2, T3, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
FindAll<TSource, T1, T2, T3, T4>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, T4, Boolean>, T1, T2, T3, T4)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T1, T2, T3, T4>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, T4, bool> match, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T1, T2, T3, T4, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
FindAll<TSource, T1, T2, T3, T4, T5>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, T4, T5, Boolean>, T1, T2, T3, T4, T5)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T1, T2, T3, T4, T5>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, T4, T5, bool> match, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T1, T2, T3, T4, T5, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
T5 | arg5 | The fifth parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
T5 | The type of the fifth parameter of the function delegate |
FindAll<TSource, T1, T2, T3, T4, T5, T6>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, T4, T5, T6, Boolean>, T1, T2, T3, T4, T5, T6)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T1, T2, T3, T4, T5, T6>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, T4, T5, T6, bool> match, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T1, T2, T3, T4, T5, T6, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
T5 | arg5 | The fifth parameter of the function delegate |
T6 | arg6 | The sixth parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
T5 | The type of the fifth parameter of the function delegate |
T6 | The type of the sixth parameter of the function delegate |
FindAll<TSource, T1, T2, T3, T4, T5, T6, T7>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, T4, T5, T6, T7, Boolean>, T1, T2, T3, T4, T5, T6, T7)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T1, T2, T3, T4, T5, T6, T7>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, T4, T5, T6, T7, bool> match, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T1, T2, T3, T4, T5, T6, T7, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
T5 | arg5 | The fifth parameter of the function delegate |
T6 | arg6 | The sixth parameter of the function delegate |
T7 | arg7 | The seventh parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
T5 | The type of the fifth parameter of the function delegate |
T6 | The type of the sixth parameter of the function delegate |
T7 | The type of the seventh parameter of the function delegate |
FindAll<TSource, T1, T2, T3, T4, T5, T6, T7, T8>(IEnumerable<TSource>, Func<TSource, T1, T2, T3, T4, T5, T6, T7, T8, Boolean>, T1, T2, T3, T4, T5, T6, T7, T8)
Retrieves all the elements that match the conditions defined by the specified function delegate.
Declaration
public static IEnumerable<TSource> FindAll<TSource, T1, T2, T3, T4, T5, T6, T7, T8>(IEnumerable<TSource> source, Func<TSource, T1, T2, T3, T4, T5, T6, T7, T8, bool> match, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<TSource, T1, T2, T3, T4, T5, T6, T7, T8, System.Boolean> | match | The function delegate that defines the conditions of the elements to search for. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
T5 | arg5 | The fifth parameter of the function delegate |
T6 | arg6 | The sixth parameter of the function delegate |
T7 | arg7 | The seventh parameter of the function delegate |
T8 | arg8 | The eighth parameter of the function delegate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
T5 | The type of the fifth parameter of the function delegate |
T6 | The type of the sixth parameter of the function delegate |
T7 | The type of the seventh parameter of the function delegate |
T8 | The type of the eighth parameter of the function delegate |
RandomOrDefault<TSource>(IEnumerable<TSource>)
Returns a random element of a sequence of elements, or a default value if no element is found.
Declaration
public static TSource RandomOrDefault<TSource>(IEnumerable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The System.Collections.Generic.IEnumerable<T> to return a random element of. |
Returns
Type | Description |
---|---|
TSource | default(TSource) if source is empty; otherwise, a random element of |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
RandomOrDefault<TSource>(IEnumerable<TSource>, Func<IEnumerable<TSource>, TSource>)
Returns a random element of a sequence of elements, or a default value if no element is found.
Declaration
public static TSource RandomOrDefault<TSource>(IEnumerable<TSource> source, Func<IEnumerable<TSource>, TSource> randomizer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The System.Collections.Generic.IEnumerable<T> to return a random element of. |
System.Func<System.Collections.Generic.IEnumerable<TSource>, TSource> | randomizer | The function delegate that will select a random element of |
Returns
Type | Description |
---|---|
TSource | default(TSource) if source is empty; otherwise, a random element of |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
RangeOf<T>(Int32, Func<Int32, T>)
Generates a sequence of T
within a specified range.
Declaration
public static IEnumerable<T> RangeOf<T>(int count, Func<int, T> resolver)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | count | The number of objects of |
System.Func<System.Int32, T> | resolver | The function delegate that will resolve the value of |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | An System.Collections.Generic.IEnumerable<T> that contains a range of |
Type Parameters
Name | Description |
---|---|
T | The type of the elements to return. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
SelectOne<TSource>(IEnumerable<TSource>, Func<IEnumerable<TSource>, TSource>)
Retrieves the element that matches the conditions defined by the specified selector
.
Declaration
public static TSource SelectOne<TSource>(IEnumerable<TSource> source, Func<IEnumerable<TSource>, TSource> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<System.Collections.Generic.IEnumerable<TSource>, TSource> | selector | The function delegate that defines the condition of the element to retrieve. |
Returns
Type | Description |
---|---|
TSource | A |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
SelectOne<TSource, T>(IEnumerable<TSource>, Func<IEnumerable<TSource>, T, TSource>, T)
Retrieves the element that matches the conditions defined by the specified selector
.
Declaration
public static TSource SelectOne<TSource, T>(IEnumerable<TSource> source, Func<IEnumerable<TSource>, T, TSource> selector, T arg)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<System.Collections.Generic.IEnumerable<TSource>, T, TSource> | selector | The function delegate that defines the condition of the element to retrieve. |
T | arg | The parameter of the function delegate |
Returns
Type | Description |
---|---|
TSource | A |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T | The type of the parameter of the function delegate |
SelectOne<TSource, T1, T2>(IEnumerable<TSource>, Func<IEnumerable<TSource>, T1, T2, TSource>, T1, T2)
Retrieves the element that matches the conditions defined by the specified selector
.
Declaration
public static TSource SelectOne<TSource, T1, T2>(IEnumerable<TSource> source, Func<IEnumerable<TSource>, T1, T2, TSource> selector, T1 arg1, T2 arg2)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<System.Collections.Generic.IEnumerable<TSource>, T1, T2, TSource> | selector | The function delegate that defines the condition of the element to retrieve. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
Returns
Type | Description |
---|---|
TSource | A |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
SelectOne<TSource, T1, T2, T3>(IEnumerable<TSource>, Func<IEnumerable<TSource>, T1, T2, T3, TSource>, T1, T2, T3)
Retrieves the element that matches the conditions defined by the specified selector
.
Declaration
public static TSource SelectOne<TSource, T1, T2, T3>(IEnumerable<TSource> source, Func<IEnumerable<TSource>, T1, T2, T3, TSource> selector, T1 arg1, T2 arg2, T3 arg3)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<System.Collections.Generic.IEnumerable<TSource>, T1, T2, T3, TSource> | selector | The function delegate that defines the condition of the element to retrieve. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
Returns
Type | Description |
---|---|
TSource | A |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
SelectOne<TSource, T1, T2, T3, T4>(IEnumerable<TSource>, Func<IEnumerable<TSource>, T1, T2, T3, T4, TSource>, T1, T2, T3, T4)
Retrieves the element that matches the conditions defined by the specified selector
.
Declaration
public static TSource SelectOne<TSource, T1, T2, T3, T4>(IEnumerable<TSource> source, Func<IEnumerable<TSource>, T1, T2, T3, T4, TSource> selector, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<System.Collections.Generic.IEnumerable<TSource>, T1, T2, T3, T4, TSource> | selector | The function delegate that defines the condition of the element to retrieve. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
Returns
Type | Description |
---|---|
TSource | A |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
SelectOne<TSource, T1, T2, T3, T4, T5>(IEnumerable<TSource>, Func<IEnumerable<TSource>, T1, T2, T3, T4, T5, TSource>, T1, T2, T3, T4, T5)
Retrieves the element that matches the conditions defined by the specified selector
.
Declaration
public static TSource SelectOne<TSource, T1, T2, T3, T4, T5>(IEnumerable<TSource> source, Func<IEnumerable<TSource>, T1, T2, T3, T4, T5, TSource> selector, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | The sequence to search. |
System.Func<System.Collections.Generic.IEnumerable<TSource>, T1, T2, T3, T4, T5, TSource> | selector | The function delegate that defines the condition of the element to retrieve. |
T1 | arg1 | The first parameter of the function delegate |
T2 | arg2 | The second parameter of the function delegate |
T3 | arg3 | The third parameter of the function delegate |
T4 | arg4 | The fourth parameter of the function delegate |
T5 | arg5 | The fifth parameter of the function delegate |
Returns
Type | Description |
---|---|
TSource | A |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the sequence. |
T1 | The type of the first parameter of the function delegate |
T2 | The type of the second parameter of the function delegate |
T3 | The type of the third parameter of the function delegate |
T4 | The type of the fourth parameter of the function delegate |
T5 | The type of the fifth parameter of the function delegate |
SortAscending<TSource>(IEnumerable<TSource>)
Returns ascending sorted elements from a sequence by using the default comparer to compare values.
Declaration
public static IEnumerable<TSource> SortAscending<TSource>(IEnumerable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | A sequence of values to order. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains ascending sorted elements from the source sequence. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
SortAscending<TSource>(IEnumerable<TSource>, IComparer<TSource>)
Returns ascending sorted elements from a sequence by using a specified System.Collections.Generic.Comparer<T> to compare values.
Declaration
public static IEnumerable<TSource> SortAscending<TSource>(IEnumerable<TSource> source, IComparer<TSource> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | A sequence of values to order. |
System.Collections.Generic.IComparer<TSource> | comparer | An System.Collections.Generic.IComparer<T> to compare values. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains ascending sorted elements from the source sequence. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
SortAscending<TSource>(IEnumerable<TSource>, Comparison<TSource>)
Returns ascending sorted elements from a sequence by using a specified System.Collections.Generic.Comparer<T> to compare values.
Declaration
public static IEnumerable<TSource> SortAscending<TSource>(IEnumerable<TSource> source, Comparison<TSource> comparison)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | A sequence of values to order. |
System.Comparison<TSource> | comparison | The System.Comparison<T> to use when comparing elements. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains ascending sorted elements from the source sequence. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
SortDescending<TSource>(IEnumerable<TSource>)
Returns ascending sorted elements from a sequence by using the default comparer to compare values.
Declaration
public static IEnumerable<TSource> SortDescending<TSource>(IEnumerable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | A sequence of values to order. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains descending sorted elements from the source sequence. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
SortDescending<TSource>(IEnumerable<TSource>, IComparer<TSource>)
Returns descending sorted elements from a sequence by using a specified System.Collections.Generic.Comparer<T> to compare values.
Declaration
public static IEnumerable<TSource> SortDescending<TSource>(IEnumerable<TSource> source, IComparer<TSource> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | A sequence of values to order. |
System.Collections.Generic.IComparer<TSource> | comparer | An System.Collections.Generic.IComparer<T> to compare values. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains descending sorted elements from the source sequence. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
SortDescending<TSource>(IEnumerable<TSource>, Comparison<TSource>)
Returns descending sorted elements from a sequence by using a specified System.Collections.Generic.Comparer<T> to compare values.
Declaration
public static IEnumerable<TSource> SortDescending<TSource>(IEnumerable<TSource> source, Comparison<TSource> comparison)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | A sequence of values to order. |
System.Comparison<TSource> | comparison | The System.Comparison<T> to use when comparing elements. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> that contains descending sorted elements from the source sequence. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
Yield<TSource>(TSource)
Returns an System.Collections.Generic.IEnumerable<T> sequence with the specified source
as the only element.
Declaration
public static IEnumerable<TSource> Yield<TSource>(TSource source)
Parameters
Type | Name | Description |
---|---|---|
TSource | source | The value to yield into an System.Collections.Generic.IEnumerable<T> sequence. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TSource> | An System.Collections.Generic.IEnumerable<T> sequence with the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of |