c# - Serializing object to XML -


i have class in c# setup serializes xml, , class has list of objects serializes well.

[xmlroot("config")] public class configserializer {      [xmlarray("nodes")]     public list<node> lstnodes { get; set; }    } 

and here class declaration node.

[xmlroot("n")] public class node {   // has few different properties } 

problem: when serialize instance of configserializer xml doesn't serialize xml expect regards node list. looks this...

<config>   <nodes>     <node></node>   </nodes> </config> 

but expect (because of xmlroot declaration node class)...

<config>   <nodes>     <n></n>   </nodes> </config> 

you can use this

    [xmlroot("config")]     public class configserializer     {         [xmlarray("nodes"),xmlarrayitem("n")]         public list<node> lstnodes { get; set; }     } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -