I've seen this answered already, but it hasn't worked for me. I'm trying to access a (non-static) class static property from the base class, from an derived instance.
In the base class:
Type type = this.GetType();
PropertyInfo propInf = type.GetProperty("DirectoryCode", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
Here propInf is null (type is the derived class type).
In the derived class:
public class DTGCSMissonParameters : ModelBase
{
public static ushort DirectoryCode = (ushort) DIR.MISSION_PARAMETERS;
Thanks
Aucun commentaire:
Enregistrer un commentaire