I\'ve was playing around with async and I\'ve happened across some behaviour I\'ve not noticed before, if this is a duplicate please let me know, but my google-fu has failed me,
See comments in line
async Task<Object> Bar()
{
var one = Foo(3000); // <-- It can Start
var two = Foo(5000); // <-- It can Start
var three = Foo(3000); // <-- It can Start
var x =
new
{
One = await one, // <-- you are waiting for it to finish
Two = await two, // <-- you are waiting for it to finish
Three = await three,// <-- you are waiting for it to finish
};
return x;
}
async Task<Object> Bar()
{
var one = await Foo(3000); // <-- you are waiting for it to finish
var two = await Foo(5000); // <-- you are waiting for it to finish
var three = await Foo(3000); // <-- you are waiting for it to finish
var x =
new
{
One = one,
Two = two,
Three = three,
};
return x;
}