Async Await
suggest changeIntroduction
In C#, a method declared async can yield during I/O-based operations instead of blocking the caller (e.g. web access, working with files, …). The result of such async marked methods may be awaited via the use of the await keyword.
Remarks
An async method can return void, Task or Task<T>.
Awaiting a Task waits until the method finishes and produces no value. Awaiting a Task<T> produces a value of type T when the method completes.
async methods should return Task or Task<T>, as opposed to void, in almost all circumstances. async void methods cannot be awaited, which leads to a variety of problems. The only scenario where an async should return void is in the case of an event handler.
async/await works by transforming your async method into a state machine. It does this by creating a structure behind the scenes which stores the current state and any context (like local variables), and exposes a MoveNext() method to advance states (and run any associated code) whenever an awaited awaitable completes.