我正在使用TypeDescriptor.GetProperties(instance)
它,它从基类返回所有属性和获取/设置方法。
我有基类:
public class Foo
{
public virtual string Name
{
get => _name;
set => _name = value;
}
}
派生类:
public class Bar : Foo
{
public override string Name => "Test";
}
当我获取“名称”属性的信息PropertyDescriptor.IsReadOnly
等于“假”时,它应该是“真”。如何设置“PropertyDescriptor”以便它只返回派生类类型的数据?