title: best way to deserialize xml in c#?
body: <p>I have following xml:</p>
  
  <pre><code>&lt;return_obj from_call_to="categories"&gt;
    &lt;categories&gt;
      &lt;category&gt;
        &lt;value&gt;12341234&lt;/value&gt;
        &lt;label&gt;First&lt;/label&gt;
      &lt;/category&gt;
      &lt;category&gt;
        &lt;value&gt;242234234&lt;/value&gt;
        &lt;label&gt;Another&lt;/label&gt;
      &lt;/category&gt;
    &lt;/categories&gt;
  &lt;/return_obj&gt;
  </code></pre>
  
  <p>so marked up an object to serialize this into</p>
  
  <pre><code>[XmlRoot(ElementName = "return_obj")]
  public class returnobject
  {
      [XmlElement]
      public category[] categories { get; set; }
  }
  
  public class category
  {
      [XmlElement]
      public string value { get; set; }
      [XmlElement]
      public string label { get; set; }
  }
  </code></pre>
  
  <p>and tried using this to do it</p>
  
  <pre><code>    var ser = new XmlSerializer(typeof (returnobject));
      var obj = (returnobject)ser.Deserialize(File.OpenRead("test.xml"));
  </code></pre>
  
  <p>However, the categories collection always some ups null.</p>
  
  <p>What am I doing wrong? Is there a better way?</p>
  
  <p>Thanks</p>