title: XmlSerializer.Deserialize only specific classes
body: <p>This is my situation. I need to create a new application which is based off existing object classes which I'm not allowed to change as its being used by other projects. But I need to use these object in conjunction with new objects in my new application. In my new application, each action will have a request and response class, which will be serialized/deserilized as it will be sent over sockets to another company. I then provide the XSD to the company which they will use to form the response and send back as XML. I then need to deserialize the XML into my newly created object, in this case its called 
  GetAccountDetailsMessageResponse.</p>
  
  <pre><code>[System.Xml.Serialization.XmlRoot("GetAccountDetailsMessageResponse", Namespace = "http://test.com.au/")]
  public class GetAccountDetailsMessageResponse 
  { 
              public MyNewHeader Header
      { 
          get; 
          set; 
      } 
  
      public AccountsResponse Response 
      { 
          get; 
          set; 
      } 
  }
  
  //Here is the  existing class structure which I need to use, and cannot
  
  // MAIN CLASS - Containing collection of Accounts
  public class AccountsResponse : ResponseHeader
  {
      public AccountsResponse()
      {
          Accounts = new List&lt;AccountResponse&gt;();
      }
  
      public List&lt;AccountResponse&gt; Accounts { get; set; }
  }
  
  public class AccountResponse : ResponseHeader
  {
      public int AccountNumber { get; set; }
  
      public string AccountType { get; set; }
  }
  
  public class ResponseHeader : MessageHeader
  {
      public string ReservedField1 { get; set; }
  
      public string ReservedField2 { get; set; }
  
      public string TextMessage { get; set; }
  
      public string Status { get; set; }
  
      public TransactStatus TransactStatus { get; set; }
  }
  
  public class MessageHeader
  {
      public string Function { get; set; }
  
      public string MessageID { get; set; }
  
      public int CustomerNumber { get; set; }
  
      public string AccessCode { get; set; }
  
      public string SessionID { get; set; }
  
      public int Flag { get; set; }
  }
  </code></pre>
  
  <p><strong>As you can see here, the class existing class structure is very annoying as most classes derive from Header. Even the actual entity, AccountResponse, which represents a single account, derives from ResponseHeader. Soy you end up with ResponseHeaders everywhere.</strong></p>
  
  <p>Using the XSD.exe tool from Microsoft, an auto-generated XSD is created which I need to give to other company.</p>
  
  <p>My problem here is, the Original AccountsResponse class derives from ResponseHeader, I already defined my own header property in GetAccountDetailsMessageResponse as Property Header.</p>
  
  <p>**So here is my question: How do get the XSD tool, or even write a C# method that serializes the object to XML, but IGNORE the ResponseHeader in the AccountsResponse class. So it should only serialize everything in AccountsResponse, and ignore everything that would be derived from ResponseHeader.</p>
  
  <p>In the end, I want the XSD.exe tool, or a custom C# method, to generate an XSD, that would provide an XML that looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/SudaK.png" alt="enter image description here"></p>