Chapter 4: Threading and Asynchronous Operations
Till now, we looked at the various design principles, patterns, what is new in .NET 5, and architecture guidelines that we are going to use during the course of this book. In this chapter, we will see how we can take advantage of asynchronous programming while building enterprise applications. One of the key measures for any web application is scalability, that is, scaling to reduce the time taken to serve a request, increase the number of requests that the server can process, and increase the number of users the application can simultaneously serve without increasing the load time. For mobile/desktop apps, scaling can improve the responsiveness of the app, allowing users to perform various actions without freezing the screen. The proper use of asynchronous programming techniques and parallel constructs can do wonders in improving these metrics, and the best thing for this in C# is the simplified syntax of Task Parallel Library (TPL...