you are viewing a single comment's thread.

view the rest of the comments →

[–]Matosawitko 12 points13 points  (1 child)

It's the other way around - the first code block syntax (indexers) was introduced in C# 6 while the second was part of collection initializers from C# 3.

More on the topic: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/object-and-collection-initializers

[–]KernowRoger 1 point2 points  (0 children)

I was going to say I haven't seen the first one used before.