Table of Contents

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

source IEnumerable<TSource>

To iterate over

seed TAccumulate

Initial aggregate

func Func<TAccumulate, TSource, int, TAccumulate>

To apply

Returns

TAccumulate

Aggregate

Type Parameters

TSource

Source type

TAccumulate

Aggregate 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

me IEnumerable<T>

The collection with which to zip

us IEnumerable<T>[]

The collections to also enumerate with

Returns

IEnumerable<T>

A single collection

Type Parameters

T

Enumerated type

Randomise<T>(IEnumerable<T>)

Returns a randomised order of the collection.

public static IEnumerable<T> Randomise<T>(this IEnumerable<T> source)

Parameters

source IEnumerable<T>

This collection

Returns

IEnumerable<T>

Collection or null if it is null

Type Parameters

T

Source 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

source IEnumerable<T>

To iterate over

Returns

IEnumerable<T>

Collection

Type Parameters

T

Any 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

me IEnumerable<T>

The collection with which to zip

us IEnumerable<T>[]

The collections to also enumerate with

Returns

IEnumerable<IEnumerable<T>>

A collection of collections

Type Parameters

T

Enumerated type