constructorless initialization and Dictionaries
- by Stacey
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!!