O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The State Machine Fueling Asynchronous Methods

When an asynchronous method executes, it may come across one or more await expressions. At that point in time, a dialogue is started with the object being awaited. This object is commonly referred to as the task, even though it doesn’t necessarily have to be a Task or Task<T> instance. We discuss the await pattern later on, also explaining how other types can be made awaitable.

What happens upon encountering a task being awaited depends on the current state of the task. Maybe the operation it represents has already been completed, allowing us to continue to execute the current method. However, most likely we’ll be unlucky and truly need to await the operation’s outcome before we can continue execution ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required