Async/await design in C#

TypeScript, C# and Turbo Pascal with Anders Hejlsberg

Topic 9 of 21

Published May 13, 2026 · Clip 29:12–33:41 (4:29)

Anders explains async/await: cooperative event-loop architectures struggle with long-running work, which requires hand-writing painful state machines. The insight was that the transformation from sequential code into a state machine can be done mechanically by the compiler—await marks where to yield a promise, and the compiler generates the switch-statement state machine, heap-allocating state that survives across awaits. This gives the illusion of sequential code while avoiding threads' preemption, weight, and UI threading problems. He acknowledges the downside of function coloring and mentions Go's goroutines/green threads as an alternative that avoids it, but argues async/await was the right solution for existing environments like JavaScript and C#.