title: Deserializing nested xml into C# objects
body: <p>I am retrieving xml data from an http web request and deserializing the data into objects.</p>
  
  <p>Here is a sample xml structure.</p>
  
  <pre><code>&lt;users&gt;
      &lt;user&gt;
          &lt;name&gt;...&lt;/name&gt;
          &lt;orders&gt;
              &lt;order&gt;
                  &lt;number&gt;...&lt;/number&gt;
              &lt;/order&gt;        
              ...
          &lt;/orders&gt;
      &lt;/user&gt;
      &lt;user&gt;
          &lt;name&gt;...&lt;/name&gt;
          &lt;orders&gt;&lt;/orders&gt;
      &lt;/user&gt;
      ...
  &lt;/users&gt;
  </code></pre>
  
  <p>I have four classes</p>
  
  <pre><code>public class Users
  {
      [XmlElement("user")]
      public User[] UserList { get; set; }
  }
  
  public class User
  {
      [XmlElement("name")]
      public string Name { get; set; }
  
      [XmlArray("orders")]
      public Orders OrderList { get; set; }
  }
  
  public class Orders
  {
      [XmlElement("order")]
      public Order[] Order { get; set; }
  }
  
  public class Order
  {
      [XmlElement("number")]
      public string Number { get; set; }
  }
  </code></pre>
  
  <p>I feel like three classes should be enough - have an Order[] in User class and get rid of 'Orders' class. Is that possible? Whatever I tried did not work.</p>
  
  <p>Thanks.</p>