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

Supporting Arbitrary Control Flow

Because you can use await expressions in (mostly) every expression context, their containing asynchronous methods can be paused in the middle of complex control flow constructs, as well. For example, an await expression may occur in the middle of a loop, requiring the method to be paused and resumed at that very point, without causing additional iterations and whatnot.

Although this seems a complex undertaking, it’s not much more complicated than the simple example with linear statement sequencing shown in the previous section. The reason is rather straightforward. At the end of the day, complex control flow structures like conditional statements, loops, and so on are nothing but branch instructions in disguise. ...

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