I have some auto-instantiation code which I would like to apply to about 15 properties in a fairly big class. The code is similar to the following but the type is differ
Try to use Hashtable or Dictionary <string, ComplexType> to group all properties. Something like this:
protected Dictionaty<string, ComplexType> _properties = new Dictionaty<string, ComplexType>();
public ComplexType Property(string name)
{
get
{
if (!properties.ContainsKey(name))
_properties[name] = new ComplexType();
return __properties[name];
}
}