If I have:
class A
{
public virtual string Owner { get; set; }
}
class B : A
{
public override string Owner { get; set; }
}
How do I determine that owner property on class B
is an override property using the TypeDescriptor.GetProperties(type)
method?
Based on @DaveShaw's comment and the answers for similar questions using propertyInfo :
var property = TypeDescriptor.GetProperties(typeof(B)).Find("Owner", false).ComponentType.GetProperty("Owner");
var getMethod = property.GetGetMethod(false);
bool isOverride = getMethod.GetBaseDefinition() != getMethod;