With the next release of the .NET Framework (.NET 4.5) and Visual Studio (2012) comes some language additions to C# and Visual Basic to support asynchronous operations. From a programmer's point of view, the language additions revolve around the introduction of two new keywords: async
and await
.
From a more holistic point of view, async
and await
(more so await)
could do nothing without a great amount of work put into the .NET class libraries, but I'll get more into that soon.
With async/await
you can write methods that are sequential in nature, but asynchronous when compiled and executed. The async
decorator on a method causes the compiler to implement the method as a state machine. As the compiler runs into await
statements it translates them into invoking asynchronous actions. The compiler basically creates a closure in response to one of the await
statements to keep track of the local state of the method while it invokes the various async
operations...