Awaiting tasks of different types
async-await, c#
Solution
How do I get the result from the requestTasks collection?
Keep it as a separate (reified) collection:
List<Task<Request>> requestTasks = CreateRequestTasks().ToList();
...
await Task.WhenAll(tasks);
var results = await Task.WhenAll(requestTasks);
Note that the second `await Task.WhenAll` won't actually do any "asynchronous waiting", because all those tasks are already completed.
Problem
``` IEnumerable<Task<Request>> requestTasks = CreateRequestTasks(); Task<Trace> traceTask = CreateTraceTask(); var tasks = new List<Task>(); tasks.AddRange(requestTasks); tasks.Add(traceTask); await Task.WhenAll(tasks); ``` How do I get the result from the `requestTasks` collection?