If I have an object :-
class c { List<b> b; }
class b { string a; }
When c is converted to XML, the resultant is :-
<c> <b> <b> <a>Hello</a> </b>...
Is there any way I can flatten the XML either through code structure or options so that I can get rid of one of the layers? I ultimately want the XML to be just :-
<c> <b> <a>Hello</a> </b>....
Or another way to look at the problem, how can deserialize :-
<c><b><a>Name</a></b><b><a>Age</a></b></c>
to a C# class structure?
Thanks in advance? If not possible, let me know please.
One option is to implement IXmlSerializable to gain full control over exactly what form the XML serialisation for your class should take.
Alternatively, you may be able to get away with decorating your classes and properties with attributes that control XML serialisation.