It seems like I have come across the answer to this question in the past but now I cannot locate it.
Suppose I have two asynchronous methods, Method1 and Method2. If I need to call Method1 and then Method2 sequentially (read, Method1 must complete before Method2), is the following code correct?
Yes, this is the correct way. They will execute sequentially.
The important quote from the msdn:
The await operator tells the compiler that the async method can't continue past that point until the awaited asynchronous process is complete.
If you wanted to execute them in parallel, you'd have to use something like this:
var t1 = DoTaskAsync(...); var t2 = DoTaskAsync(...); var t3 = DoTaskAsync(...); await Task.WhenAll(t1, t2, t3);