title: deserialize xml into inherited classes from base class
body: <p>I have the following xml structure:</p>
  
  <pre><code>&lt;Root1&gt;
      &lt;name&gt;Name1&lt;/name&gt;
      &lt;company&gt;Comp1&lt;/company&gt;
      &lt;url&gt;site.com&lt;/url&gt;
      &lt;elements&gt;
          &lt;element id="12" type="1"&gt;
              &lt;url&gt;site1.com&lt;/url&gt;
              &lt;price&gt;15000&lt;/price&gt;
              ...
              &lt;manufacturer_warranty&gt;true&lt;/manufacturer_warranty&gt;
              &lt;country_of_origin&gt;Япония&lt;/country_of_origin&gt;
          &lt;/element&gt;
          &lt;element id="13" type="2"&gt;
              &lt;url&gt;site2.com&lt;/url&gt;
              &lt;price&gt;100&lt;/price&gt;
              ...
              &lt;language&gt;lg&lt;/language&gt;
              &lt;binding&gt;123&lt;/binding&gt;
          &lt;/element&gt;
      &lt;/elements&gt;
  &lt;/Root1&gt;
  </code></pre>
  
  <p>I need to deserialize this xml into an object. You can see the element contains some equals field: <code>url</code> and <code>price</code>.
  I would like to move these fields into a parent class and then inherit this class from other classes. </p>
  
  <p>I created the class <code>Root1</code>:</p>
  
  <pre><code>namespace app1
  {
      [Serializable]
      public class Root1
      {
          [XmlElement("name")] 
          public string Name { get; set; }
  
          [XmlElement("company")] 
          public string Company { get; set; }
  
          [XmlElement("url")] 
          public string Url { get; set; }
  
          [XmlElement("elements")]
          public List&lt;Element&gt; ElementList { get; set; }
      }
  }
  </code></pre>
  
  <p>and then I created base class for <code>Element</code>:</p>
  
  <pre><code>[Serializable]
      public class Element
      {
          [XmlElement("url")] 
          public string Url { get; set; }
  
          [XmlElement("price")] 
          public string Price { get; set; }
      }
  </code></pre>
  
  <p>and then I inherited this class from other classes:</p>
  
  <pre><code>[Serializable]
  public class Element1 : Element
  {
      [XmlElement("manufacturer_warranty")] 
      public string mw { get; set; }
  
      [XmlElement("country_of_origin")] 
      public string co { get; set; }
  }
  
  [Serializable]
  public class Element2 : Element
  {
      [XmlElement("language")] 
      public string lg { get; set; }
  
      [XmlElement("binding")] 
      public string bind { get; set; }
  }
  </code></pre>
  
  <p>When I deserialize this xml to object <code>Root1</code> I get the object - it is ok.
  But the List of <code>Elements</code> contains only <code>Element</code> objects not <code>Element1</code> and <code>Element2</code> objects.</p>
  
  <p>How I do deserialize this xml so list of <code>Elements</code> contains <code>Element1</code> and <code>Element2</code> objects?</p>