In this chapter, we discussed thread-safe collections that are part of .NET Framework. Concurrent collections are available in the System.Collection.Concurrent namespace and there are collections for various use cases in programming. Some common use cases require collections that include dictionaries, lists, bags, and so on.
We also discussed a producer and consumer scenario in which data is produced by some threads and consumed by other threads at the same time. Usually, in these scenarios, there are race conditions, but concurrent collections can deal with them effectively.
In the next chapter, we will learn about improving the performance of parallel code via lazy initialization patterns.