title: C# why using reflection get field object, the first field are from child object and then from base class
body: <p>Each object stores base class properties first and then child class properties. But when I try to get object properties with reflection GetFields method I got this result:</p>
  <pre><code>Int32 j
  Int32 i
  </code></pre>
  <p>While I expected</p>
  <pre><code>Int32 i
  Int32 j
  </code></pre>
  <p>Code sample</p>
  <pre><code>using System;
  using System.Reflection;
  namespace MyProgram
  {
      class Program
      {
          static void Main()
          {
              Type t = typeof(B);
              FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.Public);
              foreach (FieldInfo fi in fields)
              {
                  Console.WriteLine(fi);
              }
              Console.ReadKey();
          }
  
      }
  
      class A
      {
          public int i = 1;
      }
  
      class B : A
      {
          public int j = 2;
      }
  }
  </code></pre>
  <p>Question: any ideas why GetFields returns properties in different order (which differs from order in which they are stored) ?</p>