1 min read

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

Student.cs

Write three properties for your new class and make your class public.

    public class Student
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public int ID { get; set; }
    }

Save your new class and in the next post we’ll initialize an dictionary and populate with some students.

Leave a Reply