From the course: C# Essential Training 2: Generics, Collections, and LINQ

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Working with keyed collections

Working with keyed collections

- [Instructor] We're back in our collection samples file here, but I have updated it with some code. So you may want to go to the begin directory for this particular movie, and load that up if you want to follow along. I've added this dictionary method. I'm going to show you how to work with those generic dictionaries. You can see here on line 115, I've created a generic dictionary where the key type is string, and the value type is person. Meaning the key, what we're going to use to uniquely identify this item, and look it up or index it is a string, and what we're going to get back or put into this dictionary as a person. So the dictionary gives us this really great way to store a set of items, but to have that unique key to go, and work with that specific item. So we don't need to know it's position in there, we don't need to go find it. We can directly access it by that key. And then on the next few lines,…

Contents