Yield and Async–Await: How They Work Internally and How to Use Them
summary
Explains how C# methods using yield return and async/await are transformed by the compiler into state-machine objects. Describes the exact shape of those generated automata, discusses particular nuances and behaviors, and gives example problems where these compiler-generated state machines can be used.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 6:00ICFP contest task
- 10:54Solution strategies
- 15:28Iterators and state machines
- 21:23Iterator problems
- 23:35Async methods and Task
- 28:31How async methods work
- 34:29Custom Task creation
- 37:21TaskBuilder implementation
- 41:35Practical use
- 43:45Real-world ideas
- 48:23Why internals matter
related talks
44mIt's All About the State, or What async/await Hides in C#?
01h 11mEverything You (Don’t) Want to Know About Async and Await in C#
01h 00mCorrecting Common Async/Await Mistakes in .NET
59mAsynchronous Programming From The Ground Up
01h 05mCorrecting Common Async/Await Mistakes in .NET 10
59mYield Return ’cause I’m Awaiting Deep Dive into Async Streams
01h 00mAvoiding common pitfalls with async/await
55mAsync internals in .NET
