I need to serialize an class related to this:
public class Root {
public string[] Elements {get;set;}
}
to an XML like this:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<Element_01>1st element</Element_01>
<Element_02>2nd element</Element_02>
<Element_03>3rd element</Element_03>
<Element_04>4th element</Element_04>
</Root>
when the object is instantiated like so:
var root = new Root {
Elements = new[] {
"1st element", "2nd element", "3rd element"
"4th element"
}
};
using the System.Xml.Serialization.XmlSerializer
.
I have to do it the other way round, too.
Is there any way to achieve this?