Useful extensions for IEnumerable<T> collections, with async in mind.
More...
|
static async Task | ForEachAsync< T > (this IEnumerable< T > collection, Func< T, Task > toRun) |
| The missing ForEach method - async variant. Don't forget to await on it!
|
static async Task | ForEachAsync< T > (this IEnumerable< T > collection, Func< T, int, Task > toRunWithIndex) |
| The missing ForEach method - asynchronous variant which also provides the current item index -> DON'T forget to await!
|
static async Task< T[]> | ToArrayAsync< T > (this Task< IEnumerable< T > > src) |
| Allows awaiting on making an async result of IEnumerable<T> into an array. Think of "ToArray" for an async result.
|
static async Task< T[]> | ToArrayAsync< T > (this Task< T[]> src) |
| Allows awaiting on making an async result of IEnumerable<T> into an array. Think of "ToArray" for an async result.
|
static async Task< T[]> | ToArrayAsync< T > (this Task< List< T > > src) |
| Allows awaiting on making an async result of IEnumerable<T> into an array. Think of "ToArray" for an async result.
|
static async Task< TAccumulator > | AggregateAsync< TAccumulator, TItem > (this IEnumerable< TItem > items, TAccumulator seed, Func< TAccumulator, TItem, Task< TAccumulator > > reducer) |
| Provides an awaitable Aggregate for collections.
|
static async Task< TOut[]> | SelectAsync< TIn, TOut > (this IEnumerable< TIn > src, Func< TIn, Task< TOut > > transform) |
| Provides an awaitable variant of Select()
|
static async Task< IEnumerable< T > > | WhereAsync< T > (this IEnumerable< T > src, Func< T, Task< bool > > discriminator) |
| Provides an awaitable .Where() where your discriminator function can be async. Will return an empty collection if operating on null.
|
Useful extensions for IEnumerable<T> collections, with async in mind.
◆ AggregateAsync< TAccumulator, TItem >()
async Task< TAccumulator > PeanutButter.Utils.AsyncExtensionsForIEnumerables.AggregateAsync< TAccumulator, TItem > |
( |
this IEnumerable< TItem > | items, |
|
|
TAccumulator | seed, |
|
|
Func< TAccumulator, TItem, Task< TAccumulator > > | reducer ) |
|
static |
Provides an awaitable Aggregate for collections.
- Template Parameters
-
- Parameters
-
items | Collection to operate on |
seed | Seed accumulator object |
reducer | Function to call on each item, reducing the overall result. It will be given the accumulator from the last round (or the seed if it is the first time it is called) and should return an accumulator which the next round can use. |
- Returns
◆ ForEachAsync< T >() [1/2]
async Task PeanutButter.Utils.AsyncExtensionsForIEnumerables.ForEachAsync< T > |
( |
this IEnumerable< T > | collection, |
|
|
Func< T, int, Task > | toRunWithIndex ) |
|
static |
The missing ForEach method - asynchronous variant which also provides the current item index -> DON'T forget to await!
- Parameters
-
collection | Subject collection to operate over |
toRunWithIndex | Action to run on each member of the collection |
- Template Parameters
-
T | Item type of the collection |
◆ ForEachAsync< T >() [2/2]
async Task PeanutButter.Utils.AsyncExtensionsForIEnumerables.ForEachAsync< T > |
( |
this IEnumerable< T > | collection, |
|
|
Func< T, Task > | toRun ) |
|
static |
The missing ForEach method - async variant. Don't forget to await on it!
- Parameters
-
collection | Subject collection to operate over |
toRun | Action to run on each member of the collection |
- Template Parameters
-
T | Item type of the collection |
◆ SelectAsync< TIn, TOut >()
async Task< TOut[]> PeanutButter.Utils.AsyncExtensionsForIEnumerables.SelectAsync< TIn, TOut > |
( |
this IEnumerable< TIn > | src, |
|
|
Func< TIn, Task< TOut > > | transform ) |
|
static |
Provides an awaitable variant of Select()
- Template Parameters
-
- Parameters
-
src | Source collection to operate on |
transform | |
- Returns
◆ ToArrayAsync< T >() [1/3]
async Task< T[]> PeanutButter.Utils.AsyncExtensionsForIEnumerables.ToArrayAsync< T > |
( |
this Task< IEnumerable< T > > | src | ) |
|
|
static |
Allows awaiting on making an async result of IEnumerable<T> into an array. Think of "ToArray" for an async result.
- Template Parameters
-
- Parameters
-
- Returns
◆ ToArrayAsync< T >() [2/3]
async Task< T[]> PeanutButter.Utils.AsyncExtensionsForIEnumerables.ToArrayAsync< T > |
( |
this Task< List< T > > | src | ) |
|
|
static |
Allows awaiting on making an async result of IEnumerable<T> into an array. Think of "ToArray" for an async result.
- Template Parameters
-
- Parameters
-
- Returns
◆ ToArrayAsync< T >() [3/3]
async Task< T[]> PeanutButter.Utils.AsyncExtensionsForIEnumerables.ToArrayAsync< T > |
( |
this Task< T[]> | src | ) |
|
|
static |
Allows awaiting on making an async result of IEnumerable<T> into an array. Think of "ToArray" for an async result.
- Template Parameters
-
- Parameters
-
- Returns
◆ WhereAsync< T >()
async Task< IEnumerable< T > > PeanutButter.Utils.AsyncExtensionsForIEnumerables.WhereAsync< T > |
( |
this IEnumerable< T > | src, |
|
|
Func< T, Task< bool > > | discriminator ) |
|
static |
Provides an awaitable .Where() where your discriminator function can be async. Will return an empty collection if operating on null.
- Template Parameters
-
- Parameters
-
src | Source collection |
discriminator | Discriminator function |
- Returns
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/AsyncExtensionsForIEnumerables.cs