using System.Collections.Generic;
public class TestClass {
public Dictionary<string, string> Data {get; set;}
}
public class Program
{
public static void Main()
var dict = new TestClass
// there is no clue, that the syntax is wrong, at run time it is throwing error => NullReference (why?)
Data = {
{"dict1", "disct1"},
{"dict2", "disct2"},
{"dict3", "disct3"},
};
// Here I initialized directly, and assigning in the same way as above, it's showing compilation error, which is correct.
// var dictCompileTimeError = new Dictionary<string, string>();
// dictCompileTimeError = {
// {"test1", "test1"}
// }