C# Chained ContinueWith Not Waiting for Previous Task to Complete
问题 I am testing the asynchronousity of C# async/await and came across a surprise where the subsequent code for ContinueWith does not wait for the previous task to complete: public async Task<int> SampleAsyncMethodAsync(int number,string id) { Console.WriteLine($"Started work for {id}.{number}"); ConcurrentBag<int> abc = new ConcurrentBag<int>(); await Task.Run(() => { for (int count = 0; count < 30; count++) { Console.WriteLine($"[{id}] Run: {number}"); abc.Add(count); } }); Console.WriteLine($