Monica
❔ XML serialization woes
I'm trying to use XmlSerializer, and for some reason I can't get it to serialize an array of child elements. If I specify the name manually (in the XmlElementAttribute) it works fine, but I already specify the element name on the target type using XmlTypeAttribute.
My types look something like this:
And the XML I'm trying to (de)serialize looks like this:
To validate that the serialization works, I'm currently doing this:
Is there something I'm missing in order to allow XmlSerializer to read the XmlTypeAttribute for these types, or do I have to specify the element name using XmlElementAttribute? I've not been able to find anything on the docs that would suggest otherwise.
2 replies