user310291
user310291

Reputation: 38180

What does this syntax means ["@metadata"] = new Dictionary<string, object> : is it .net syntax for dictionary?

What ["@metadata"] means is it .NET syntax ? :

https://dzone.com/articles/answer-what-does-this-code-do

    var doc = new Dictionary<string,object>
{
    ["@metadata"] = new Dictionary<string, object>
    {
        ["@id"] = "users/1"
    }
    ["Name"] = "Oren"
};
Console.WriteLine(doc["Name"]);

Upvotes: 1

Views: 163

Answers (1)

Rob
Rob

Reputation: 27357

Yes, it's part of C# syntax - using the new indexer initializer available in C#6.

Upvotes: 2

Related Questions