Archives
-
Understanding C# async / await (2) The Awaitable-Awaiter Pattern
Understanding C# async / await:
- Understanding C# async / await (1) Compilation
- Understanding C# async / await (2) Awaitable-Awaiter Pattern
- Understanding C# async / await (3) Runtime Context
What is awaitable
Part 1 shows that any Task is awaitable. Actually there are other awaitable types. Here is an example:
Task<int> task = new Task<int>(() => 0); int result = await task.ConfigureAwait(false); // Returns a ConfiguredTaskAwaitable<TResult>.
The returned ConfiguredTaskAwaitable<TResult> struct is awaitable. And it is not Task at all:
-
Understanding C# async / await (1) Compilation
Understanding C# async / await:
- Understanding C# async / await (1) Compilation
- Understanding C# async / await (2) Awaitable-Awaiter Pattern
- Understanding C# async / await (3) Runtime Context
Now the async / await keywords are in C#. Just like the async and ! in F#, this new C# feature provides great convenience. There are many nice documents talking about how to use async / await in specific scenarios, like using async methods in ASP.NET 4.5 and in ASP.NET MVC 4, etc. This article will look at the real code working behind the syntax sugar.
As MSDN stated:
The async modifier indicates that the method, lambda expression, or anonymous method that it modifies is asynchronous.
Also since lambda expression / anonymous method will be compiled to normal method, this article will focus on normal async method.
-
Recover Outlook 2010 from crash
Today my Outlook 2010 crashed while I am writing an email. When I restart I got this error: