Async and Await in C#
Talk it through out loud with your AI coach.
The problem
- easy
- Pro
An ASP.NET Core endpoint reads from a database and then calls another web service. A colleague asks why the code uses async and await at all, and whether it would be simpler to call dot Result on the tasks. Explain what await actually does and why blocking on a task is a bad idea.
What a strong answer covers
- What a task stands for and what happens at an await.
- Why freeing threads matters for a busy web server.
- The risks of blocking on unfinished work.
- Habits that keep async code healthy across a whole codebase.
Common mistake: Thinking await starts a new thread to run the work, when for input and output there's usually no thread busy at all while it waits.
Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.
Practise it out loud