XML : Deserialize multiple XML tags to single C# object

I have class structure as follows

     public class Common      {          public int price { get; set; }          public string color { get; set; }      }      public class SampleProduct:Common      {          public string sample1 { get; set; }          public string sample2 { get; set; }          public string sample3 { get; set; }      }    

I have XML file as follows

  <ConfigData>    <Common>      <price>1234</price>      <color>pink</color>        </Common>    <SampleProduct>      <sample1>new</sample1>      <sample2>new</sample2>      <sample3>new123</sample3>    </SampleProduct>  </ConfigData>    

Now I wanted to deserialize full XML data to SampleProduct object (single object).I can deserialize XML data to different object but not in a single object. Please help.

No comments:

Post a Comment