how to access all public variables in the class sequentially?
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()
精彩评论