Top "Collection-initializer" questions

Collection Initializer is a C# syntactic sugar for compact declaration of collection objects with items.

Initialize list with both a single object and another list of objects

I want to initialize a list with an object and a list of objects in that specific order. Currently, I …

c# collections collection-initializer
What benefits does dictionary initializers add over collection initializers?

In a recent past there has been a lot of talk about whats new in C# 6.0 One of the most …

c# dictionary collections c#-6.0 collection-initializer
Anonymous collection initializer for a dictionary

Is it possible to implicitly declare next Dictionary<HyperLink, Anonymous>: { urlA, new { Text = "TextA", Url = "UrlA" } }, { urlB, new { …

c# .net dictionary anonymous-types collection-initializer
Using collection initializer syntax on custom types?

I have a large static list which is basically a lookup table, so I initialise the table in code. private …

c# collections collection-initializer