I want to access all public variables declared in the class sequentially. Which is the best way to do it?
He just wants the public _variables_, not the methods and functions.
Oded
2009-12-24 09:25:01
+8
A:
FieldInfo [] fields = typeof(YourClass).GetFields(BindingFlags.Public | BindingFlags.Instance);
this will return FieldInfo on all the public fields
monkey_p
2009-12-24 09:26:46
Tip: You might need (BindingFlags.Public | BindingFlags.Instance); if the class is not static.
Jason Evans
2009-12-24 09:31:21