Is there a different between
var taskA = GetObjectA();
var taskB = GetObjectB();
var taskC = GetObject3();
await Task.WhenAll(taskA, taskB, taskC);
return new AllTasksResponse
{
A = taskA.Result,
B = taskB.Result,
C = taskC.Result
};
and
return new AllTasksResponse
{
A = await GetObjectA(),
B = await GetObjectB(),
C = await GetObjectC()
};
?
Basically, I want to know if creating a new object that awaits for multiple tasks to finish runs them asynchronously. Or should I use WhenAll (or WaitAll) in these cases to ensure that all tasks will run in parallel?