Summary
In this chapter, we learned how to leverage parallel programming concepts in our .NET applications. We got hands-on with Parallel.For
, Parallel.ForEach
, and Parallel.ForEachAsync
loops. In those sections, we learned how to safely aggregate data while maintaining thread safety. Next, we learned how to manage relationships between parent tasks and their parallel children. This will help to ensure your applications maintain an expected order of operations.
Finally, we covered some important pitfalls to avoid when implementing parallelism in our applications. Developers will want to pay close attention to avoid any of these pitfalls in their own applications.
To read more about data parallelism in .NET, the Data Parallelism documentation on Microsoft Docs is a great place to start: https://docs.microsoft.com/dotnet/standard/parallel-programming/data-parallelism-task-parallel-library.
In the next chapter, we will continue our exploration of the TPL by learning how to leverage...