April 2013
Intermediate to advanced
1700 pages
92h 51m
English
Because the new await keyword is used in an expression context, some complexity applies to maintaining the evaluation stack across the initiation of the asynchronous operation and its completion. The technique used to make this work is called stack spilling.
To understand this complexity and how to deal with it, consider the following example of an asynchronous method:
async Task<int> Demo(){ return Bar() + (Foo() + (Qux() + await Baz()));}
In this piece of code, we call four methods as part of one big expression. Of those four methods, the first three simply return an int. The Baz method, however, returns a Task<int> that will be awaited.
Notice the use of parentheses ...
Read now
Unlock full access