Reputation: 6712
I'm currently reading about serialization and C# attributes related to serialization (XmlRoot, XmlElement, XmlArray, ...).
I want to output something like this:
<root>
<a>...</a>
<b>...</b>
<c>...</c>
<c>...</c>
<c>...</c>
</root>
(where the c
element occurs several times)
But I don't get how to have multiple c
without having them inside a specific "array/list node".
Because I really don't want that:
<root>
<a>...</a>
<b>...</b>
<cList>
<c>...</c>
<c>...</c>
<c>...</c>
</cList>
</root>
How can this be achieved?
Upvotes: 1
Views: 709
Reputation: 8099
Try it like this:
[XmlElement("c")]
public List<c> cList { get; set; }
Upvotes: 7