I want to get value of field of base class, in child class, by name of field:
class A
{
protected static double? x;
}
class B : A
{
B()
: base()
{
x = 13F;
}
void test()
{
double? s = this.GetType().
GetField("x", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null) as double?;
}
}
why i have TargetException, when i call test() method?