From the course: Advanced C#: Thread-Safe Data with Concurrent Collections

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Create a dictionary

Create a dictionary

- [Instructor] This is the chapter where we focus on working with a ConcurrentDictionary. So what I'd thought we'd start with is looking at the sample code that we'll work with throughout this chapter. Now way I have written this code is it's working with a standard, generic dictionary, and as we go through this chapter we'll transform the code, or convert it, to work with the ConcurrentDictionary. So I'm inside this console application. I don't need to see the Solution Explorer so let's switch to full screen mode by going to shift alt enter. Now we have more code on the screen. Let's start out in static void main method with a try catch block to handle any errors, and then I call Demo. Inside Demo is where we'll see the majority of the dictionary operations so we'll look at how to add an item, how to remove an item, how to update an item, to get the count of the items in the dictionary, also show how to iterate over…

Contents