Deserialize multiple XML elements with the same name through XmlSerializer class in C#

后端 未结 3 1209
萌比男神i
萌比男神i 2020-12-31 08:51

I have an XML in the form

 
    0  
    0  
           


        
3条回答
  •  梦谈多话
    2020-12-31 09:27

    You should just have to do the following for this to work:

    [XmlElement]
    public int[] ScheduledDay { get; set; }
    

    By adding this attribute, every time the ScheduledDay element is seen by the (de)serializer it will know to add it to this array.

提交回复
热议问题