Learn the why behind the code.
Build deeper .NET knowledge through practical explanations, real C# examples, and exercises that prepare you for technical interviews.
Explore the curriculumWhat really happens when you await?
An async method uses Tasks and a compiler-generated state machine. An incomplete await can yield and later resume without blocking the thread; an already-complete await may continue immediately. async/await does not automatically create a new thread.
Predict the output
What is printed?
Console.Write("A");
await Task.CompletedTask;
Console.Write("B");Show hint
A completed awaitable can keep running inline.
var userTask = GetUserAsync(id);
var ordersTask = GetOrdersAsync(id);
await Task.WhenAll(userTask, ordersTask);Explain how async/await works in C# and what happens when an awaited Task has not yet completed.
An async method uses Tasks and a compiler-generated state machine. An incomplete await can yield and later resume without blocking the thread; an already-complete await may continue immediately. async/await does not automatically create a new thread.
Async I/O can wait without blocking a managed thread. A continuation later needs a thread, often from the ThreadPool in ASP.NET Core. SynchronizationContext controls some continuation scheduling; ExecutionContext carries AsyncLocal data. ConfigureAwait(false) neither suppresses ExecutionContext nor forces a thread switch.