I want to create several properties on the fly inside the class' constructor and add them to the current class. The property's template is the following
public [PropertyType] [PropertyName]
{
get {return Container.Resolve();}
}
I've read a little about CodeDom and Reflection.Emit but haven't been able to figure out how to use them in this particular use case.
Any clue would be greatly appreciated. Thanks in advance
EDIT: I'm elaborating on the purpose due to the number of questions... I'm trying to implement the base class for a view model locator. The binding in xaml is achieved through referring to a property by its path, therefore it MUST be a property. The types and names of the properties to be added are known only at runtime, therefore I'm using reflection to get them. In short, I need an example of taking a piece of code and compiling it dynamically into the given class.