我正在寻找一种方法来不引用类名,但仍能达到预期的效果。 我不能执行 ITypedList.GetType(),因为它是一个接口(interface)。
public class DerivedList : ITypedList
...
public PropertyDescriptorCollection GetItemProperties()
{
return TypeDescriptor.GetProperties(typeof(DerivedList));
}
...
我想知道这是否可能。
干杯,
编辑:尝试用没有提及它自己的类名的东西替换它
最佳答案
绝对...
public PropertyDescriptorCollection GetItemProperties()
{
return TypeDescriptor.GetProperties(this);
}
关于c# - 如何在不提及派生类名称的情况下返回接口(interface)类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/896061/