title: How to loop all class variables with key and value
body: <p>I'm making an Save Version checker and if version doesn't match transport old variable values into new.</p>
  
  <p>I have this class</p>
  
  <pre class="lang-cs prettyprint-override"><code>[System.Serializable]
  public class SavePattern
  {
      public int SaveVersion = 1;
      public string Name;
      public int Electricity;
      public string[] Inventory;
  }
  </code></pre>
  
  <p>I want to loop all public variables of class and be able to use it like key and value variable.</p>