About This eBook 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

O'Reilly logo

A Primer to await Expressions

Asynchronous methods contain one or more await expressions. If no await expressions are present in the method, a compiler warning is generated telling the method will execute synchronously under all circumstances, questioning why the method was declared using the async modifier to begin with. Figure 31.20 shows this warning.

Image

FIGURE 31.20 Asynchronous methods can complete synchronously.

await expressions provide points in an asynchronous method body where the method can be suspended and resumed. Upon hitting an await expression, the compiler-generated code first evaluates the operand, which we referred to as the awaited ...

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