You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this variant of Aggregate defined in one of my projects, using an async accumulator:
/// <summary>
/// Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
/// </summary>
/// <param name="source"></param>
/// <param name="seed"></param>
/// <param name="func"></param>
/// <typeparam name="TSource"></typeparam>
/// <typeparam name="TAccumulate"></typeparam>
/// <returns></returns>
public static async Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, Task<TAccumulate>> func)
{
TAccumulate state = seed;
await source.ForEachAsync(async e =>
{
state = await func(state, e);
});
return state;
}
I noticed that the current Aggregate methods here don't have this overload, do you think it's worth adding it? If so, its implementation should probably be optimised etc.
The text was updated successfully, but these errors were encountered:
I have this variant of Aggregate defined in one of my projects, using an async accumulator:
I noticed that the current Aggregate methods here don't have this overload, do you think it's worth adding it? If so, its implementation should probably be optimised etc.
The text was updated successfully, but these errors were encountered: