Calling and awaiting several tasks and getting the results
In some cases we want to run several tasks and wait for them to complete before executing more code, but the results do not have anything in common with each other.
Example:
Task<A> task1 = GetA();
Task<B> task2 = GetB();
await Task.WhenAll(task1, task2);
var task1Res = await task1;
var task2Res = await task2;
// Do something
This ends up being a lot of lines of code, while what I really want to do is get the results back from Task.WhenAll().
Something like this would be nice:
var (a, b) = await Task.WhenAll(GetA(), GetB());
// Do something
Reference: https://stackoverflow.com/questions/17197699/awaiting-multiple-tasks-with-different-results
Looking similar to https://github.com/dotnet/corefx/issues/25756
@kevingosse is right. This is the same as dotnet/runtime#24372 and it has been discussed in https://github.com/dotnet/corefx/issues/16010 and decided not to do it. Also there is a NuGet package out there which can help in the needed scenario.
CC @stephentoub