Creating XML structure using xml attributes

前端 未结 1 1321
刺人心
刺人心 2021-01-27 07:24

I am trying to solve a puzzle with xml attributes. The problem is that we already have widely used file with this structure, from which I can\'t deviate



        
1条回答
  •  走了就别回头了
    2021-01-27 07:47

    Looks like I just solved it. I have never seen this before, looked on MSDN, hence I didn't try it. But I tried instead of this

    [XmlArrayItem(ElementName = "CONFIG", Type = typeof(MyConfigSchema))]
    public MyConfigSchema[] Schemas { get; set; }
    

    do this

    [XmlElement(ElementName = "CONFIG", Type = typeof(MyConfigSchema))]
    public MyConfigSchema[] Schemas { get; set; }
    

    Instead of XmlArrayItem I placed XmlElement and it worked. I didn't know one can mark List or array with plain element attribute.

    0 讨论(0)
提交回复
热议问题