Scenario:
You need to call two async functions and use results of both the functions in a calculation. Without the ForkJoin, you'll be forced to store the first result on a variable while you call the 2nd function.
A a = null;
await getA()
.Then(result => {
a = result;
return getB();
})
.Then(b => Process(a, b));
With forkJoin:
await GetA()
.ForkJoin(() => GetB()) // optionally .ForkJoin(a => GetB(a)) if that was required.
.Then((a, b) => Process(a, b));
Signature:
public static Task<Outcome<ValueTuple<A, B>>> ForkJoin<A, B>(
this Task<Outcome<A>> source,
Func<Task<Outcome<B>>> handler
)