ResultExtensionsMapReduceAsyncT(IEnumerableT, FuncT, TaskRes) Method

(async version) Applies the result mapper to the collection and reduces it to a single result:
  • returns Ok when all results are Ok;
  • Ok if the collection is empty;
  • the first Err otherwise.

Definition

Namespace: Orx.Fun.Result
Assembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
C#
public static Task<Res> MapReduceAsync<T>(
	this IEnumerable<T> collection,
	Func<T, Task<Res>> map
)

Parameters

collection  IEnumerableT
Collection of values.
map  FuncT, TaskRes
Function that maps each element of the collection to a result.

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "M:Orx.Fun.Result.ResultExtensions.MapReduceAsync``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Threading.Tasks.Task{Orx.Fun.Result.Res}})"]

Return Value

TaskRes

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also