Chapter 9: Working with Concurrent Collections in .NET
This chapter will dive deeper into some of the concurrent collections in the System.Collections.Concurrent
namespace. These specialized collections help to preserve data integrity when using concurrency and parallelism in your C# code. Each section of this chapter will provide practical examples of how to use a specific concurrent collection provided by .NET.
We have seen some basic use of parallel data structures in .NET. We have already covered the basics of each of the concurrent collections in the Introduction to concurrency section of Chapter 2. So, we will quickly jump into the examples of their use in this chapter and learn more about their application and inner workings.
In this chapter, we will do the following:
- Using
BlockingCollection
- Using
ConcurrentBag
- Using
ConcurrentDictionary
- Using
ConcurrentQueue
- Using
ConcurrentStack
By the end of this chapter, you will have a deeper understanding...