Asp.net mvc5 . async await. wait on task with diff return types
.net, async-await, asynchronous, c#, task-parallel-library
Solution
You can just create a `List<Task>` and then use `Task.WhenAll`:
var tasks = new List<Task>();
var task1 = Func1Async();
tasks.Add(task1);
var task2 = Func2Async();
tasks.Add(task2);
...
await Task.WhenAll(tasks);
Note that since the return types differ, you have to pull the results out individually:
var result1 = await task1;
var result2 = await task2;
Problem
I just started working with .net mvc 5 async await . I have few tasks which i determine at run time to run parallel . All of them have different return types and i want to use Task.WhenAll to wait on them. Like this question discusses, but i don't have the predefined set of tasks to run . I need to create a collection of tasks with different return types at run time and wait .