开发者

IEnumerable.GetProperties()

I have class 开发者_运维技巧Foo, which derived from interface IFoo and IEnumerable

public class Foo:IFoo,IEnumerable
{
   public decimal Count {...}
   ///etc...
}

How to call GetProperties(), that it's return only public properties of IEnumerable (not IFoo or this class)?


To get the properties of IEnumerable, you don't even need to reference Foo:

typeof(IEnumerable).GetProperties();

Once you have the properties and you're ready to get values using the PropertyInfo object, then you can pass it an instance of the Foo class to get the values from.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜