I am creating a dictionary in a C# file with the following code:
private readonly Dictionary FILE_TYPE_DICT
= new Dictiona
You can initialize a Dictionary (and other collections) inline. Each member is contained with braces:
Dictionary students = new Dictionary
{
{ 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 } }
};
See MSDN for details.