OptionExtensionsMapT1, T2, TOut(OptValueTupleT1, T2, FuncT1, T2, TaskTOut) Method
(async version) Allows an option of a tuple (t1, t2) to map with a function taking two arguments t1 and t2.
static int Add(int a, int b) => a + b;
var numbers = Some((1, 2));
var sum = numbers.Map(Add);
Assert(sum == Some(3));
This is mostly useful in enabling function composition.
Namespace: Orx.Fun.OptionAssembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
public static Task<Opt<TOut>> Map<T1, T2, TOut>(
this Opt<(T1 , T2 )> option,
Func<T1, T2, Task<TOut>> map
)
- option OptValueTupleT1, T2
- Option to be mapped.
- map FuncT1, T2, TaskTOut
- Map function.
- 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.
TaskOptTOutIn Visual Basic and C#, you can call this method as an instance method on any object of type
OptValueTupleT1,
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).