lookin my XML example, how I do to Deserialize it?
But I need to Deserialize the Xml Element array. How I do it?
<hotels num="1">
<hotel num="1" item="2"></hotel>
<hotel num="2" item="2"></hotel>
<hotel num="3" item="2"></hotel>
<hotel num="4" item="2"></hotel>
<hotel num="5" item="2"></hotel>
</hotels>
[Serializable]
[XmlRoot("hotels")]
public class Hotels
{
[XmlElement("id")]
public string id { get; set; }
[XmlElement("hotel")]
public Hotel hotel { get; set; }
}
[Serializable]
[XmlRoot("hotel")]
public class Hotel
{
[XmlElement("id")]
public string id { get; set; }
[XmlElement("item")]
public string item { get; set; }
}
Try like this:
and then deserialize: