If the tasks you expect have a result of the same type, Task.WhenAll returns an array of them. For example, for this class:
public class Test { public async Task<TestResult> TestAsync() { await Task.Delay(1000);
We get the following results:
var myCollection = new List<Test>(); myCollection.Add(new Test()); IEnumerable<TestResult> results = await Task.WhenAll(myCollection.Select(v => v.TestAsync()));
source share