title: How can I find all the public fields of an object in C#?
body: <p>I'm constructing a method to take in an ArrayList(presumably full of objects) and then list all the fields(and their values) for each object in the ArrayList.</p>
  
  <p>Currently my code is as follows:</p>
  
  <pre><code>public static void ListArrayListMembers(ArrayList list)
      {
          foreach (Object obj in list)
          {
              Type type = obj.GetType();
              string field = type.GetFields().ToString();
              Console.WriteLine(field);
  
          }
      }
  </code></pre>
  
  <p>Of course, I understand the immediate issue with this code: if it worked it'd only print one field per object in the ArrayList. I'll fix this later - right now I'm just curious how to get all of the public fields associated with an object.</p>