title: Load object data from XML in C#
body: <p>I have the following class:</p>
  
  <pre><code>[Serializable]
  
  public class SerialAssassin
  {
      public Hero hero;
      public Point heroPB;
      public Boss boss;
      public Point bossPB;
      public Attack attack;
      public Point attackPB;
      public HPMeter bossHP;
      public Point bossHPPB;
      public PPMeter heroPP;
      public Point heroPPPB;
  
      public Rectangle bossRect;
      public Rectangle attackRect;
  
      public int heroState;
      public int stepRate;
      public int attackDirection;
      public int attackLoop;
      public int contadorPaso;
      public int contadorPasoBoss;
      public int bossTop, bossLeft;
      public int bossState;
      public int bossHealth;
      public int bossHPCap;
      public int opa;
      public int battlesWon;
      public int mainBossCounter;
      public int ppleft;
      public bool paso;
      public bool inStadium;
      public bool fading;
      public bool fightingMainBoss;
      public bool fainted;
      public string currentPokemon;
  }
  </code></pre>
  
  <p>I'm having problems reading the data from the XML, which was written as follows:</p>
  
  <pre><code>XmlSerializer serializer = new XmlSerializer(typeof(SerialAssassin));
  TextWriter textWriter = new StreamWriter(@"..\..\Resources\saveState.xml");
  serializer.Serialize(textWriter, serial);
  textWriter.Close();
  </code></pre>
  
  <p>From there, I don't quite know how to read the data. Plus the fact that the XML doesn't serialize the objects of Hero, Boss, Attack, HPMeter, PPMeter.</p>
  
  <p>Hero class:</p>
  
  <pre><code>public class Hero
      {
  
          int state = 0;
          int x, y;
          string path;
          Image img;
  
  
          //methods
      }
  </code></pre>
  
  <p>I'd be grateful if you would be so kind as to explain to me how to load those objects/primitives and then use them.</p>