dictionary
Initialize a dictionary with a collection initializer in C# Part 1 – Create a Student Class
Time to create a dictionary in C# from the programming guide here. First create a new class file named Write three properties for your new class and make your class public. Save your new class and in the next post we’ll initialize an dictionary and populate with some students.
Initialize a dictionary with a collection initializer in C# Part 3 – Loop through the dictionary
With our dictionary of students created we can now loop through it to retrieve both Keys and values. We will make use of the Enumerable.Range so make sure to add the Linq to your class. Now write the foreach loop. Now let’s run the app and see the result! There you go! Wow! Great work […]
Creating a dictionary in .NET Part 3 – Reading elements
Now it’s time to read some from our dictionary. First let’s see if there’s a key you want to see. Great! Let’s enumerate the dictionary next. Awesome! Now go out and create some dictionaries!
Creating a dictionary in .NET Part 2 – Adding elements
Now it’s time to add two elements to the dictionary. In the next post we’ll check our key for the value.
Creating a dictionary in .NET
Create a string dictionary Adding elements Reading elements
You must be logged in to post a comment.