Adding values to a dictionary via inline initialization of its container

this is actual inline intialization:

private IDictionary<string, string> localizedNames = new Dictionary<string, string>{
    {"key1","value1"},
    {"key2","value2"}
};

Update:
If you are using C# 6.0 or later, key value based syntax is also supported:

IDictionary<string, string> localizedNames = new Dictionary<string,string>
{
    ["key1"] = "value1",
    ["key2"] = "value2",
    ["key3"] = "value3"
};

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)