Your Ultimate async / await Tutorial in C#
Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
The main benefits of asynchronous programming using async
/ await
include the following:
-
Increase the performance and responsiveness of your application, particularly when you have long-running operations that do not require to block the execution. In this case, you can perform other work while waiting for the result from the long running task.
-
Organize your code in a neat and readable way significantly better than boilerplate code of the traditional thread creation and handling. with
async
/await
, you write less code and your code will be more maintainable than using the previous asynchronous programming methods such as using plain tasks. -
async
/await
is the newer replacement toBackgroundWorker
, which has been used on windows forms desktop applications. -
You make use of the latest upgrades of the language features, as
async
/await
was introduced in C# 5, and there have been some improvements added to the feature like foreach async and generalized async type likeValueTask
.