← C# Programming learning pathC# Programming · Module 8 of 10
Async programming
Write responsive code with async and await.
📖 Key ideas
- async methods return Task or Task<T>.
- await waits without blocking the thread.
- Use async for I/O: HTTP calls, files, databases.
- Task.WhenAll runs tasks concurrently.
- Avoid async void except for event handlers.
💡 Real-life example: async/await is putting rice to cook and chopping vegetables meanwhile, instead of staring at the pot.
TaskRepresents async work
awaitWaits for a task without blocking
Task.WhenAllWaits for many tasks
CancellationTokenSignals cancellation