I have a class with two properties for max and min values. It looks like this (ish):
public class Configuration { public int Max { get; set; } public int Min { get; set; } }
When I serialize this I get something like:
<Configuration> <Max>10</Max> <Min>0</Min> </Configuration>
However, I need an extra element like this:
<Configuration> <Bounds> <Max>10</Max> <Min>0</Min> </Bounds> </Configuration>
To do that you would need to introduce an extra layer into the object model, too.
XmlSerializerlikes the xml to be (roughly) a direct map to the objects:The only other option is to implement
IXmlSerializable, but you really don’t want to do that unless you absolutely have no choice.