Given this code... Why will Main1() take ~ 1 second but Main2() only 500 ms?
Why does it make a difference to store the Task in a variable first and awaiting then?
async Task Main1()
{
await DoStuff(1);
await DoStuff(2);
}
async Task Main2()
{
var t1 = DoStuff(1);
var t2 = DoStuff(2);
await t1;
await t2;
}
async Task DoStuff(int number)
{
await Task.Delay(500);
Console.WriteLine(number);
}