fill dictionary c# code example
Example 1: c# initialize dictionary
Dictionary<int, string> dictNew = new Dictionary<int,string>()
{
{1, "true"},
{2, "false"}
}
Example 2: fill dictionary c#
var students = new Dictionary<int, StudentName>()
{
{ 111, new StudentName {FirstName="Sachin", LastName="Karnik", ID=211}},
{ 112, new StudentName {FirstName="Dina", LastName="Salimzianova", ID=317}},
{ 113, new StudentName {FirstName="Andy", LastName="Ruth", ID=198}}
};