Object Initializers

There are 1 entries for the tag Object Initializers

Collection Initializers

File this in my learn something new every day bucket. I received an email from Steve Maine after he read a blog post in which I discuss the anonymous object as dictionary trick that Eilon came up with. He mentioned that there is an object initializer syntax for collections and dictionaries. var foo = new Dictionary<string, string>() { { "key1", "value1" }, { "key2", "value2" } }; That’s pretty nice! Here is a post by Mads Torgersen about collections and collection initializers. Naturally someone will mention that the Ruby...