h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Dictionary initializer in C#

Dictionary initialize in C# 

  You can easily initialize a Dictionary Object using a Collection Initialize, which is there since C# 3.0.
  Collection initialize adds one of the  parameter as Key and another as  Value corresponding to the assigned Key.

Dictionary<int, string> students = new Dictionary<int, string> {
{1, "Student 1" },
{2, "Student 2" },
{3, "Student 3" },
{4, "Student 4" }
};