Task.WhenAll for parallel execution
📖 Scenario: You are building a simple program that fetches data from multiple sources at the same time. This helps save time because the program does not wait for one source to finish before starting the next.
🎯 Goal: Learn how to use Task.WhenAll to run multiple tasks in parallel and wait for all of them to complete.
📋 What You'll Learn
Create three tasks that simulate data fetching with delays
Use a configuration variable to set the delay time
Use
Task.WhenAll to run all tasks in parallelPrint the results after all tasks complete
💡 Why This Matters
🌍 Real World
Fetching data from multiple web services or databases at the same time to improve performance.
💼 Career
Understanding parallel execution with Task.WhenAll is important for building efficient and responsive applications in C#.
Progress0 / 4 steps