XmlSerializer - There was an error reflecting type

后端 未结 18 1633
借酒劲吻你
借酒劲吻你 2020-11-28 02:46

Using C# .NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passi

18条回答
  •  再見小時候
    2020-11-28 03:44

    I had a situation where the Order was the same for two elements in a row

    [System.Xml.Serialization.XmlElementAttribute(IsNullable = true, Order = 0, ElementName = "SeriousInjuryFlag")]
    

    .... some code ...

    [System.Xml.Serialization.XmlElementAttribute(IsNullable = true, Order = 0, ElementName = "AccidentFlag")]
    

    When I changed the code to increment the order by one for each new Property in the class, the error went away.

提交回复
热议问题