ResultExtensionsMapT1, T2, TOut(ResValueTupleT1, T2, FuncT1, T2, TaskTOut) Method

(async version) Allows a result of a tuple (t1, t2) to map with a function taking two arguments t1 and t2.
C#
static int Add(int a, int b) => a + b;

var numbers = Ok((1, 2));
var sum = numbers.Map(Add);
Assert(sum == Some(3));
This is mostly useful in enabling function composition.

Definition

Namespace: Orx.Fun.Result
Assembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
C#
public static Task<Res<TOut>> Map<T1, T2, TOut>(
	this Res<(T1 , T2 )> result,
	Func<T1, T2, Task<TOut>> map
)

Parameters

result  ResValueTupleT1, T2
Result to be mapped.
map  FuncT1, T2, TaskTOut
Map function.

Type Parameters

T1
Type of the first argument of the map function.
T2
Type of the second argument of the map function.
TOut
Type of return value of the map function.

Return Value

TaskResTOut

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ResValueTupleT1, T2. 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