public void MyMethod() > { > PropertyInfo pi = this.GetType().GetProperty("EnableSomething"); > bool b = (bool) pi.GetValue(this, null); > }(with a sprinkling of checking for nulls, etc :-}
>> >>public class MyBase() >>{ >> >> public method MyMethod() >> { >> // I want to access the EnableSomething property of the specific class here >> // There is a reference to the class in a property >> this.RunningClass. // property not available. How to get it? >> } >>} >> >>public class MyAppLevelBase() : MyBase >>{ >> //Property added here >> public bool EnableSomething >> { >> get {return this._enableSomething; } >> set {this._enableSomething = value; } >> } >>} >> >>// bunch of classes like this one >>public class MyClass1() : MyAppLevelBase >>{ >> public MyClass1() >> { >> this.EnableSomething = true; >> } >>} >>