There is a main class having 2 subClasses(each represent separate entity) and all classes needs to be serialized.. how should I proceed ? My requirement is when I serelize MainClass, I should get the xml for each sub class and main class as well. Thanks in advance... and if my approach is incorrect... correct that as well..
Ex given below...
class MainClass
{
SubClass1 objSubclass1 = null;
SubClass2 objSubclass2 = null;
public MainClass()
{
objSubclass1 = new SubClass1();
objSubclass2 = new SubClass2();
}
[XmlElement("SubClass1")]
public SubClass1 SubClass1 {get {return objSubclass1;} }
[XmlElement("SubClass2")]
public SubClass2 SubClass2 {get {return objSubclass2;} }
}
Class SubClass1
{
Some properties here...
}
Class SubClass2
{
Some properties here...
}