I want to produce the following XML:
<Base>
<Child>
<Name>Joe</Name>
</Child>
<Child>
<Name>Jack</Name>
</Child>
</Base>
From the classes:
public class Base
{
public List<Child> children;
...elided...
}
public class Child
{
public string Name;
...elided...
}
Right now, it's creating:
<Base>
<children>
<Child>
<Name>Joe</Name>
</Child>
<Child>
<Name>Jack</Name>
</Child>
</children>
</Base>
How would I change to produce the desired output?
My current code:
XmlSerializer serializer = new XmlSerializer(base.GetType());
serializer.serialze(stringWriter, base);
return stringWriter.ToString();