---
source: https://iinventedlight.com/library/notes/csharp-async-await.md
title: "C# async and await: start tasks, don't block, compose with WhenAll"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (dotnet/docs); restated in our own words"
attribution: "Summary by iinventedlight (AI-assisted). Sources: Microsoft Learn, Asynchronous programming with async and await, CC BY 4.0 (dotnet/docs); Microsoft Learn, Asynchronous programming scenarios, CC BY 4.0 (dotnet/docs)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-05
as_of: 2026-11-05
confidence: medium
untested: "Steps and code were not run; only the fetched documentation page was read."
category: coding-references
topic_area: "code-systems: asynchronous C#"
tags: csharp, dotnet, async, tasks
sources:
  - id: S1
    title: "Asynchronous programming with async and await"
    publisher: Microsoft Learn
    url: https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/
    accessed: 2026-11-05
    license: "CC BY 4.0 (dotnet/docs)"
  - id: S2
    title: "Asynchronous programming scenarios"
    publisher: Microsoft Learn
    url: https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/async-scenarios
    accessed: 2026-11-05
    license: "CC BY 4.0 (dotnet/docs)"
    license: "CC BY 4.0 (dotnet/docs)"
---
# C# async and await: start tasks, don't block, compose with WhenAll

## Short answer
Mark a method `async` and return `Task` or `Task<T>`. `await` waits without blocking the thread. Start independent work first, then combine with `Task.WhenAll`. [S1]

## Pattern
```csharp
async Task<Breakfast> MakeBreakfastAsync()
{
    var eggsTask  = FryEggsAsync(2);
    var baconTask = FryBaconAsync(3);
    await Task.WhenAll(eggsTask, baconTask);
    return new Breakfast(await eggsTask, await baconTask);
}
```

## Rules of thumb
- `await` frees the thread while the work finishes. [S1]
- Awaiting each task as you create it still runs them one after another; start them first to overlap. [S1]
- Factor a series of steps into a method that returns a task, then compose those tasks. [S1]
- Prefer `WhenAll` over `.Result` / `.Wait()` on unfinished tasks. [S1]
- The same `async`/`await` model covers I/O-bound and CPU-bound work; CPU work usually goes through `Task.Run`. [S2]

## Claims
- id: C1
  claim: await provides a nonblocking way to start a task.
  source: S1
  evidence: "The await keyword provides a nonblocking way to start a task"
- id: C2
  claim: Awaiting sequentially delays starting other tasks.
  source: S1
  evidence: "doesn't start other tasks until the current work completes"
- id: C3
  claim: WhenAll completes when every listed task completes.
  source: S1
  evidence: "completes when all the tasks in its argument list are complete"
- id: C4
  claim: Async code can model both I/O-bound and CPU-bound work.
  source: S2
  evidence: "for both I/O-bound and CPU-bound scenarios"
- id: C5
  claim: CPU-bound async work is typically started on a background thread.
  source: S2
  evidence: "starts an operation on a background thread with the Task.Run method"

## Sources
- [S1] Asynchronous programming with async and await. Microsoft Learn. https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/ . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-05.
- [S2] Asynchronous programming scenarios. Microsoft Learn. https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/async-scenarios . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-05.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

Source notice: .NET documentation © Microsoft. Licensed under Creative Commons Attribution 4.0 International (https://github.com/dotnet/docs/blob/main/LICENSE).
