So I have a the following classes
class Person
{
virtual string Property{get;set;}
}
and
class Manager : Person
{
[SomeAttribute("Hello")]
override string Property {get;set;}
}
If I have a member expression on type Manager, ie:
Property prop = PropertyGetter.GetProp<Manager>(p => p.Property)
Then the ReflectedType of the MemberExpression
is Person
, rather than Manager
. This means that the Attribute
information is lost. So:
var attribute = prop.GetAttribute<SomeAttribute>();
Then attribute
is null.
I'm assuming this is because the property is from the base class, not defined in Manager, but how can I get around this?