Deserializing different named xml nodes
- by Andreas
Hi.
Is there a way to convert different named xml nodes into one class when deserializing an XML
Example XML:
<items>
<aaa>value</aaa>
<bbb>value</bbb>
</items>
Normaly i would write:
[XmlRoot("items")]
class Items
{
[XmlElement("aaa")]
public string aaa;
[XmlElement("bbb")]
public string bbb;
}
But now i would like to do something like this
[XmlRoot("items")]
class Items
{
[XmlElement("aaa")]
[XmlElement("bbb")]
public List<string> item;
}
Here I would love if "aaa" and "bbb" was added to the same list.