title: C# Serialize inherited class without base properties
body: <p>I have a base class with some properties like:  </p>
  
  <pre><code>public class BaseClass {  
    public string Name { get; set; }  
    public string Comment { get; set; }  
  }  
  </code></pre>
  
  <p>And classes who extend the base class like:  </p>
  
  <pre><code>public class A : BaseClass {  
    public string AProperty{ get; set; }  
  }  
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class B : BaseClass {  
    public string BProperty{ get; set; }  
  }  
  </code></pre>
  
  <p>Now I need to be able to serialize the data from the extension and from the base class into different Locations.<br>
  And for deserialization I need to be able to deserialize one of the classes and "merge" with base class who was deserialized earlier.<br>
  The baseclass is mine so I can change it as needet, but not the extension classes (A and B in my sample).<br>
  It would be nice to have a solution that works with XML and JSON (Newtonsoft JSON serializer) serializer.
  Thanks for ideas.</p>