In this chapter, we covered what threading is and how to use it. We looked at the problems of deadlocks and race conditions in action, and we saw how to prevent these exceptional circumstances using a lock statement and the TPL library. We also discussed the thread safety of static constructors, static methods, immutable objects, and mutable objects. We saw why using immutable objects is a thread-safe way of transferring data between threads, and we reviewed some general recommendations for working with threads.
We also saw how making your code thread-safe can have a lot of benefits. In the next chapter, we will look at designing effective APIs. But for now, you can test your knowledge by answering the following questions and you can further your reading by referring to the links provided.