c# literal dictionary code example
Example 1: c# initialize dictionary
Dictionary<int, string> dictNew = new Dictionary<int,string>()
{
{1, "true"},
{2, "false"}
}
Example 2: c# inline initialize dictionary
var testDict = new Dictionary<string, string>() { ["key1"] = "value1", ["key2"] = "value2" };
Example 3: dctionary literal c#
var data = new Dictionary<string, string>
{
{ "test", "val" },
{ "test2", "val2" }
};