If I have two Tasks that I am Awaiting:
await FirstTask();
await SecondTask();
Will the SecondTask only begin execution once FirstTask is complete?
Thanks
If I have two Tasks that I am Awaiting:
await FirstTask();
await SecondTask();
Will the SecondTask only begin execution once FirstTask is complete?
Thanks
Yes that is what happens.
await FirstTask();
await SecondTask(); // doesn't start until FirstTask() finishes
If you want to have them run in parallel, and await both, you can use Task.WhenAll
var task1 = FirstTask();
var task2 = SecondTask(); // starts right away, even if FirstTask is still busy
await Task.WhenAll(task1, task2);