How do i declare a new lookup class for a property in the object initializer routine in c#?
E.g.
new Component() { ID = 1, Name = "MOBO", Category = new Lookup<int, string> }
The category bit always get a compile error.
I have a property called Category
that is of the type Lookup<int, string>
and I want to instantiate this property via
new Component() { ID = 1, Name = "MOBO", Category = new Lookup<int, string> };
But I cannot get past the compile errors.
See Question&Answers more detail:os