Class IEnumerableExtensions
- Namespace
- Garyon.Extensions
- Assembly
- Garyon.dll
Contains extensions for the IEnumerable<T> interface.
public static class IEnumerableExtensions
- Inheritance
-
IEnumerableExtensions
- Inherited Members
Methods
ConcatMultiple<T>(IEnumerable<T>, params IEnumerable<IEnumerable<T>>)
Concatenates multiple IEnumerable<T>s and returns the concatenated result.
public static IEnumerable<T> ConcatMultiple<T>(this IEnumerable<T> source, params IEnumerable<IEnumerable<T>> others)
Parameters
sourceIEnumerable<T>The source IEnumerable<T> to concatenate with the others.
othersIEnumerable<IEnumerable<T>>The other IEnumerable<T>s to concatenate.
Returns
- IEnumerable<T>
Type Parameters
TThe type of the elements the IEnumerable<T>s hold.
ConcatMultiple<T>(IEnumerable<T>, params IEnumerable<T>[])
Concatenates multiple IEnumerable<T>s and returns the concatenated result.
public static IEnumerable<T> ConcatMultiple<T>(this IEnumerable<T> source, params IEnumerable<T>[] others)
Parameters
sourceIEnumerable<T>The source IEnumerable<T> to concatenate with the others.
othersIEnumerable<T>[]The other IEnumerable<T>s to concatenate.
Returns
- IEnumerable<T>
Type Parameters
TThe type of the elements the IEnumerable<T>s hold.
ConcatMultiple<T>(IEnumerable<T>, params ReadOnlySpan<IEnumerable<T>>)
Concatenates multiple IEnumerable<T>s and returns the concatenated result.
public static IEnumerable<T> ConcatMultiple<T>(this IEnumerable<T> source, params ReadOnlySpan<IEnumerable<T>> others)
Parameters
sourceIEnumerable<T>The source IEnumerable<T> to concatenate with the others.
othersReadOnlySpan<IEnumerable<T>>The other IEnumerable<T>s to concatenate.
Returns
- IEnumerable<T>
Type Parameters
TThe type of the elements the IEnumerable<T>s hold.
EqualsUnordered(IEnumerable, IEnumerable)
Determines whether all the elements of a collection are equal to all the respective elements of another collection in any order.
public static bool EqualsUnordered(this IEnumerable source, IEnumerable other)
Parameters
sourceIEnumerableThe first collection.
otherIEnumerableThe second collection.
Returns
- bool
true if all the elements of any of the collections match exactly one unique element in the other collection, otherwise false. This is determined by whether both collections are subsets of each other.
EqualsUnordered<T>(IEnumerable<T>, IEnumerable<T>)
Determines whether all the elements of a collection are equal to all the respective elements of another collection in any order.
public static bool EqualsUnordered<T>(this IEnumerable<T> source, IEnumerable<T> other)
Parameters
sourceIEnumerable<T>The first collection.
otherIEnumerable<T>The second collection.
Returns
- bool
true if all the elements of any of the collections match exactly one unique element in the other collection, otherwise false. This is determined by whether both collections are subsets of each other.
Type Parameters
T
FlattenInstant<T>(IEnumerable<IEnumerable<IEnumerable<T>>>)
Flattens a collection of collections of collections into a single collection. The resulting elements are contained in the order they are enumerated depth-first.
public static IEnumerable<T> FlattenInstant<T>(this IEnumerable<IEnumerable<IEnumerable<T>>> source)
Parameters
sourceIEnumerable<IEnumerable<IEnumerable<T>>>The collection of collections of collections.
Returns
- IEnumerable<T>
The flattened collection.
Type Parameters
TThe type of elements contained in the collections.
Remarks
The function enumerates all the elements and caches them. This may induce a latency during enumeration of the collections. Prefer calling this function when enumeration of the same flattened collections is performed more than once.
FlattenInstant<T>(IEnumerable<IEnumerable<T>>)
Flattens a collection of collections into a single collection. The resulting elements are contained in the order they are enumerated depth-first.
public static IEnumerable<T> FlattenInstant<T>(this IEnumerable<IEnumerable<T>> source)
Parameters
sourceIEnumerable<IEnumerable<T>>The collection of collections.
Returns
- IEnumerable<T>
The flattened collection.
Type Parameters
TThe type of elements contained in the collections.
Remarks
The function enumerates all the elements and caches them. This may induce a latency during enumeration of the collections. Prefer calling this function when enumeration of the same flattened collections is performed more than once.
Flatten<T>(IEnumerable<IEnumerable<IEnumerable<T>>>)
Flattens a collection of collections of collections into a single collection. The resulting elements are contained in the order they are enumerated depth-first.
public static IEnumerable<T> Flatten<T>(this IEnumerable<IEnumerable<IEnumerable<T>>> source)
Parameters
sourceIEnumerable<IEnumerable<IEnumerable<T>>>The collection of collections of collections.
Returns
- IEnumerable<T>
The flattened collection.
Type Parameters
TThe type of elements contained in the collections.
Flatten<T>(IEnumerable<IEnumerable<T>>)
Flattens a collection of collections into a single collection. The resulting elements are contained in the order they are enumerated depth-first.
public static IEnumerable<T> Flatten<T>(this IEnumerable<IEnumerable<T>> source)
Parameters
sourceIEnumerable<IEnumerable<T>>The collection of collections.
Returns
- IEnumerable<T>
The flattened collection.
Type Parameters
TThe type of elements contained in the collections.
MinMax<TSource, TComparable>(IEnumerable<TSource>, Func<TSource, TComparable>)
Gets the minimum and maximum values within the collection.
public static ValueBounds<TComparable> MinMax<TSource, TComparable>(IEnumerable<TSource> source, Func<TSource, TComparable> selector) where TComparable : IMinMaxValue<TComparable>, IComparisonOperators<TComparable, TComparable, bool>
Parameters
sourceIEnumerable<TSource>selectorFunc<TSource, TComparable>
Returns
- ValueBounds<TComparable>
The minimum and maximum values.
Type Parameters
TSourceTComparable