Possible Duplicate:
Find a private field with Reflection?
I am trying to display a class's field names using the System.Reflection.GetFields() method.
Problem is it only works when the fields are declared as "public". For example :
class Element
{
private String id;
private string a;
private string b;
private int c;
private Dictionary<String, String> dict;
public Element(String id)
{
this.id= id;
}}
When I try calling the System.Reflection.GetFields() method, it doesn't work (it returns an empty array). However, if I change the visibility of the fields to "public", it works..
Anyone know how I can get it to work without having to make it public?
Thanks