constructorless initialization and Dictionaries
Posted
by Stacey
on Stack Overflow
See other posts from Stack Overflow
or by Stacey
Published on 2010-03-13T22:13:05Z
Indexed on
2010/03/13
22:15 UTC
Read the original article
Hit count: 222
c#3.0
Using C# 3.0, we can initialize objects without their constructors for syntactical reasons. Such as ..
ClassName c = new ClassName = { Property1 = "Value" }
I was wondering how this works with Dictionaries and adding the items to them. Any ideas?
class Foo { public Dictionary DictionaryObject { get; set; } }
Foo f = new Foo = { // ??? }
Thank you for your time!!
© Stack Overflow or respective owner