static void Main(string[] args) { Program p = new Program(); Console.WriteLine(1); p.Go(); Console.WriteLine(2); Console.ReadLine(); } async Task Go() { Console.WriteLine(3); await a(); Console.WriteLine(4); } async Task a() { Console.WriteLine(5); int i = await b(); Console.WriteLine(i); } async Task<int> b() { Console.WriteLine(6); await Task.Delay(5000); Console.WriteLine(7); int i = 999; return i; }
2以后暂停几秒后继续执行