C # element - Xml with attribute and node value
I have an Xml that I need to deserialize into an object. Xml:
<Person> <Type id="1234">Bob</Type> </Person> and classes:
public class Person { public Type Type; } public class Type { [XmlAttribute("id")] public string id; // another property for value "Bob" here, such as: public string value; // ???? } I would like to deserialize this Xml using XmlSerializer.Deserialize , into the specific objects above (avoiding using XPath, etc.)
What Xml attribute can be decorated with the Type class so that I have not only the id attribute, but also the value ("Bob")?
+6