This library contains extensions for tasks.
dotnet add package Softlr.TaskEx
The library provides a simple way of awaiting multiple task results with as little code as possible.
Typically when you want to await multiple tasks you will be doing something like
task1.Start();
task2.Start();
await task1;
await task2;
or
await Task.WhenAll(task1, task2);
With this library you can simplify this to
await (task1, task2);
But the real improvement is if you need to await multiple tasks that return some values. Typically you'd do something like
task1.Start();
task2.Start();
var result1 = await task1;
var result2 = await task2;
This can be simplified using this library to
var (result1, result2) = await (task1, task2);
The results can be of completely different types, the tasks will run simultanously but the code will wait until all of the tasks finish processing.
This method can be used to await results for up to 7 tasks at the same time (7 is the limit of generic parameters of the TaskAwaiter
class on which this code depends).