Basics of async and await
When the TPL was introduced in .NET Framework 4.5, C# 5.0 also added language support for task-based asynchronous programming with the async
and await
keywords. This immediately became the default method of implementing asynchronous workflows in C# and .NET. Now, 10 years later, async
/await
and the TPL have become an integral part of building robust, scalable .NET applications. You might be wondering why it is so important to adopt async programming in your applications.
Understanding the async keyword
There are many reasons for writing async code. If you’re writing server-side code on a web server, using async allows the server to handle additional requests while your code is awaiting a long-running operation. On a client application, freeing the UI thread to perform other operations with async code allows your UI to remain responsive to users.
Another important reason to adopt async programming in .NET is that many third-party and open source...