I am looking for new object initializers in C # 3.0 and would like to use them. However, I cannot figure out how to use them with something like Microsoft Unity. I probably missed something, but if I want to keep strongly typed property names, then I'm not sure I can. e.g. I can do it (pseudo code)
Dictionary<string,object> parms = new Dictionary<string,object>(); parms.Add("Id", "100"); IThing thing = Factory.Create<IThing>(parms)();
and then do something in Create through reflection to initialize the parms ... but if I want it to be strongly typed at the Create level, like the new intitalisers object, then I donβt see how I can.
Is there a better way? Thanks
Graham
source share