我有一个类Foo,它从接口IFoo和IEnumerable派生而来
public class Foo:IFoo,IEnumerable
{
public decimal Count {...}
///etc...
}如何调用GetProperties(),使其只返回IEnumerable的公共属性(而不是IFoo或此类)?
发布于 2010-09-24 20:57:04
要获得IEnumerable的属性,甚至不需要引用Foo
typeof(IEnumerable).GetProperties();一旦拥有了属性并准备好使用PropertyInfo对象获取值,就可以向它传递Foo类的一个实例以从中获取值。
https://stackoverflow.com/questions/3787221
复制相似问题