Serialize A List<T> Produces Flat Results C#



TODO:

Have you serialzied an object that had a List<T> as a property, and the list is flattened when it gets to XML?

 

SOLUTION:

This occurs if you have the property marked as [XmlElement("name")].  instead mark the property as [XmlArray("name")] and you will get parent child nodes for your List<T>

 

NOTES:

There are no notes on this topic



Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading