I have some XML that I need to deserialise
<element>
<childElement key="myKey1">a value</childElement>
<childElement key="myKey2">another value</childElement>
</element>
Into a class like
[XmlRoot(ElementName="element")]
public class Element
{
public string MyKey1 { get; set; }
public string MyKey2 { get; set; }
}
Is it possible for me to annotate MyKey1 and MyKey2 so that if the xml above is deserialised then MyKey1 will be "a value" and MyKey2 will equal "another value"? If not then what is the best approach to deserialising attributes like this?