Skip root elements for sub classes when serializing complex object
-
how do we skip root elements for sub classes when serailizing comlex object? my requirement is Assume we have a complex class public class employee { private string _name; private string empcode; private list
addresses; //Assume we have created public properties also } public class Address { private string street; private string city; private string state; //Assume we have created public properties also } if we serialize above employee collection class in XML the output would be ABC 1/EmpCode>
XXX xxx yyy
XXX xxx yyy
but i want the above xml as ABC 1/EmpCode>
XXX xxx yyy
XXX xxx yyy
i just removed means removing root element for inner classes. how do we achieve this using .NET Thanks inadvance Regards Ravi
-
how do we skip root elements for sub classes when serailizing comlex object? my requirement is Assume we have a complex class public class employee { private string _name; private string empcode; private list
addresses; //Assume we have created public properties also } public class Address { private string street; private string city; private string state; //Assume we have created public properties also } if we serialize above employee collection class in XML the output would be ABC 1/EmpCode>
XXX xxx yyy
XXX xxx yyy
but i want the above xml as ABC 1/EmpCode>
XXX xxx yyy
XXX xxx yyy
i just removed means removing root element for inner classes. how do we achieve this using .NET Thanks inadvance Regards Ravi
Can I suggest you select the 'Encode HTML tags when pasting' tickbox when pasting XML code into a post - most of your content has disappeared! Also, it helps to put it in a code block, using the 'code block' link below when the code is selected.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p