Table of Contents

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

source IEnumerable<T>

The source IEnumerable<T> to concatenate with the others.

others IEnumerable<IEnumerable<T>>

The other IEnumerable<T>s to concatenate.

Returns

IEnumerable<T>

Type Parameters

T

The 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

source IEnumerable<T>

The source IEnumerable<T> to concatenate with the others.

others IEnumerable<T>[]

The other IEnumerable<T>s to concatenate.

Returns

IEnumerable<T>

Type Parameters

T

The 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

source IEnumerable<T>

The source IEnumerable<T> to concatenate with the others.

others ReadOnlySpan<IEnumerable<T>>

The other IEnumerable<T>s to concatenate.

Returns

IEnumerable<T>

Type Parameters

T

The 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

source IEnumerable

The first collection.

other IEnumerable

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.

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

source IEnumerable<T>

The first collection.

other IEnumerable<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

source IEnumerable<IEnumerable<IEnumerable<T>>>

The collection of collections of collections.

Returns

IEnumerable<T>

The flattened collection.

Type Parameters

T

The 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

source IEnumerable<IEnumerable<T>>

The collection of collections.

Returns

IEnumerable<T>

The flattened collection.

Type Parameters

T

The 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

source IEnumerable<IEnumerable<IEnumerable<T>>>

The collection of collections of collections.

Returns

IEnumerable<T>

The flattened collection.

Type Parameters

T

The 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

source IEnumerable<IEnumerable<T>>

The collection of collections.

Returns

IEnumerable<T>

The flattened collection.

Type Parameters

T

The 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

source IEnumerable<TSource>
selector Func<TSource, TComparable>

Returns

ValueBounds<TComparable>

The minimum and maximum values.

Type Parameters

TSource
TComparable