Expanded Library

C# Concurrent Collections

by Simon Robinson

Learn how to use concurrent collections in multithreaded code! This course will teach you the correct use of ConcurrentDictionary, as well as introducing you to producer-consumer scenarios and the blocking collection.

What you'll learn

Learn how to use concurrent collections in multithreaded code! This course is a comprehensive introduction to the concurrent collections. It shows you how to use each of the main collection types: ConcurrentDictionary, ConcurrentQueue, ConcurrentBag, and ConcurrentStack. You'll learn the correct techniques for using these collections to avoid bugs such as race conditions, and also how to use BlockingCollection with the concurrent collections correctly in producer-consumer scenarios. The course rounds off with a look at some concurrent collection best practices.

Table of contents

About the author

Simon Robinson first cut his developer teeth in the early 1980s writing a scheduling system in BBC Basic(!) for his local college. Since then, his programming career has spanned industries ranging from academic research to telecoms to finance, and many computer languages such as C++, C# and Python, as well as writing front-end and back-end code for Windows and Web. He believes knowledge is to be shared, and has written or co-written more than a dozen books for professional programmers, includin... more

Ready to upskill? Get started