Hello. We have the following code:

public partial class Forecast { [Key] [XmlIgnore] public int Id { get; set; } [XmlArray("location")] [XmlArrayItem("day", typeof(Day_))] public List<Day_> day { get; set; } } public class Day_ { [XmlAttribute] public string value { get; set; } [XmlAttribute] public string name { get; set; } [XmlElement] public Symbol_ symbol { get; set; } ... [XmlArray("day")] [XmlArrayItem("hour", typeof(Hour_))] public List<Hour_> hour { get; set; } } public class Hour_ { [XmlAttribute] public string value { get; set; } public Value_ temp { get; set; } public Symbol_ symbol { get; set; } public Wind_Hour wind { get; set; } public Value_ wind_gusts { get; set; } public FValue_ rain { get; set; } public Val_ humidity { get; set; } public Value_ pressure { get; set; } public SVal_ clouds { get; set; } public Value_ snowline { get; set; } public Value_ windchill { get; set; } } 

The elements of the hour array are not serialized.

  • What does the class look like? - Monk
  • Updated the question. - Rustam

1 answer 1

The issue is resolved. It turns out you need to more carefully describe the structure of XML. There was no description for the location element. It is better to copy the XML file to the clipboard and paste it as classes. The method found on this site.

  • 2
    If the method is described on this site, add a link to the solution to your answer - rdorn