c# - XML Serialization to many nodes -
c# - XML Serialization to many nodes -
i'm looking next structure
<emailaddresses> <email>email@email.com</email> <email>email@email.com</email> </emailaddresses>
here have tried
[xmlroot("emailaddresses")] public class emailaddress { [xmlelement("email")] public string email { get; set; } }
writing
xmlserializer author = new xmlserializer(typeof(list<emailaddress>), new xmlrootattribute("emailaddresses")); using (filestream fs = file.create(filename)) { writer.serialize(fs, emailaddresses); }
my current output
<emailaddresses xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <emailaddress> <email>something here</email> </emailaddress> <emailaddress> <email>something here</email> </emailaddress> </emailaddresses>
one many nodes
figured out
[xmlroot("emailaddresses")] public class emailaddress { [xmlelement("email")] public list<string> emails { get; set; } }
c# xml-serialization
Comments
Post a Comment