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?
await Method1();
await Method2();
Based on information from the accepted answer to another SO question here and information in the MSDN article here, I believe this is the correct way to do it. Also, this code appears to work but I don't want to introduce a subtle bug that will be much harder to track down later.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…