How does Asynchronous tasks (Async/Await) work in .Net 4.5?
Some sample code:
private async Task<bool> TestFunction()
{
var x = await DoesSomethingExists();
var y = await DoesSomethingElseExists();
return y;
}
Does the second await
statement get executed right away or after the first await
returns?
await
pauses the method until the operation completes. So the second await
would get executed after the first await
returns.
For more information, see my async
/ await
intro or the official FAQ.