Class IEnumerableExtensions
- Namespace
- WhatIsHeDoing.Core.Extensions
- Assembly
- WhatIsHeDoing.Core.dll
Provides extension methods for the IEnumerable interface.
public static class IEnumerableExtensions
- Inheritance
-
IEnumerableExtensions
- Inherited Members
Methods
Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, int, TAccumulate>)
Aggregate with the index of the current element.
public static TAccumulate Aggregate<TSource, TAccumulate>(this IEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, int, TAccumulate> func)
Parameters
sourceIEnumerable<TSource>To iterate over
seedTAccumulateInitial aggregate
funcFunc<TAccumulate, TSource, int, TAccumulate>To apply
Returns
- TAccumulate
Aggregate
Type Parameters
TSourceSource type
TAccumulateAggregate type
Remarks
Leaves the underlying implementation to throw!
IterateJagged<T>(IEnumerable<T>, params IEnumerable<T>[])
Flattens a collection of collections of unequal lengths after calling ZipJagged.
public static IEnumerable<T> IterateJagged<T>(this IEnumerable<T> me, params IEnumerable<T>[] us)
Parameters
meIEnumerable<T>The collection with which to zip
usIEnumerable<T>[]The collections to also enumerate with
Returns
- IEnumerable<T>
A single collection
Type Parameters
TEnumerated type
Randomise<T>(IEnumerable<T>)
Returns a randomised order of the collection.
public static IEnumerable<T> Randomise<T>(this IEnumerable<T> source)
Parameters
sourceIEnumerable<T>This collection
Returns
- IEnumerable<T>
Collection or null if it is null
Type Parameters
TSource type
Exceptions
- ArgumentNullException
Thrown if the source is null
WhereNotNull<T>(IEnumerable<T>)
Filters all null elements from a collection.
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> source)
Parameters
sourceIEnumerable<T>To iterate over
Returns
- IEnumerable<T>
Collection
Type Parameters
TAny type
ZipJagged<T>(IEnumerable<T>, params IEnumerable<T>[])
Enables a collection of unequal collection lengths to be iterated together, effectively as columns.
public static IEnumerable<IEnumerable<T>> ZipJagged<T>(this IEnumerable<T> me, params IEnumerable<T>[] us)
Parameters
meIEnumerable<T>The collection with which to zip
usIEnumerable<T>[]The collections to also enumerate with
Returns
- IEnumerable<IEnumerable<T>>
A collection of collections
Type Parameters
TEnumerated type