I create a dynamic type at run-time (please see how here: Serialize/Deserialize a dynamic object) and use that type to create a dynamic member in another class.
public class SomeClass
{
private dynamic _AnimalType = CreateAnimal<Animal>("Dog");
public dynamic AnimalType { get { return _AnimalType; } }
static internal PropertyInfo[] Sprops = typeof(SomeClass).GetProperties();
static public PropertyInfo[] getPropertyInfos() { get { return Sprops; } }
}
However, when the following is called:
PropertyInfo[] Sprops = typeof(SomeClass).GetProperties();
Sprops contains one PropertyInfo (System.Object
), which is 'exptected' but not what is 'wanted'. I would like to get the Type that AnimalType is currently (Animal
, or more specifically Dog
). Is there any way to accomplish this? I do not want to have to create an instance of this class and then call some "SetInternalProperties" method. The idea is to have the properties readily available as a static.