- Home /
Question by
fred_gds · Mar 25, 2016 at 09:50 PM ·
serializationsavexmlsaveloadxmlserializer
Xml Serialization of "sub classes"
Hello,
I have a question on how to use XML serialization. As I have the following construction of classes:
public class MainClass
{
public int someInt;
public SubClass1[] object1;
}
public class SubClass1
{
public int someInt;
public SubClass2[] object1;
}
public class SubClass2
{
public int someInt;
public int someOtherInt;
}
So if I want to serialize the MainClass. Could I just [XmlAttribute] and [XmlArray] over each variable, as well as [XmlRoot] over each Class and then the rest will be done by the serialization process?
Or do I only need to place one XmlRoot over the Main class?
Or will this not work at all and I need to Save each class by its own?
Comment