Eduasync part 9: generated code for multiple awaits
Last time we looked at a complex async method with nested loops and a single await. This post is the exact opposite – the method is going to look simple, but it will have three await expressions in. If you’re glancing down this post and feel put off by the amount of code, don’t worry – once you’ve got the hang of the pattern, it’s really pretty simple. Here’s the async method we’re going to analyze: private static async Task<int> Sum3ValuesAsyncWithAssistance() { Task<int> task1 = Task.Factory.StartNew(() => 1); Task<int> task2 = Task.Factory.StartNew(() => 2); Task<int> task3 = Task.Factory.StartNew(() => … Continue reading Eduasync part 9: generated code for multiple awaits