Summary
Wrapping up, writing, and maintaining clean asynchronous code is difficult. However, with the various constructs available in .NET and C#, developers can now write asynchronous code with less framework overhead and focus more on the business requirements. In this chapter, we covered various ways to write scalable asynchronous code using the TPL, async-await, and concurrent collections, and we also covered the fundamentals of threads and ThreadPool
in .NET to understand the framework internals and write cleaner code for enterprise applications. Now we have a deeper understanding of multi-threading and how to protect shared data in a multi-threaded environment. We learned about creating tasks and implementing asynchronous functions using async-await, and finally we learned about the concurrent collections available in .NET Core and their implementation in various concurrent scenarios.
In the next chapter, we will look into dependency injection in .NET 5 and how it plays a...