开发者

how to access all public variables in the class sequentially?

开发者_JAVA技巧

I want to access all public variables declared in the class sequentially. Which is the best way to do it?


FieldInfo [] fields = typeof(YourClass).GetFields(BindingFlags.Public | BindingFlags.Instance);

this will return FieldInfo on all the public fields


typeof(MyClass).GetMembers()
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜