XML serialization of enums

后端 未结 5 2010
悲&欢浪女
悲&欢浪女 2021-01-02 08:54

I have problems with serializing enum values.

Here is the code:

[System.Xml.Serialization.XmlRootAttribute(Namespace = \"\", IsNullable = false)]
pub         


        
5条回答
  •  自闭症患者
    2021-01-02 09:53

    In your actual code, is the member:

    • public
    • read+write (for fields: not readonly; for properties: public get+set)
    • of a public type

    ?

    All 3 must be true. For nested types, every parent type in the nesting must be public.

    Additional things that would exclude it:

    • nullable and null
    • is if DefaultValue
    • a ShouldSerialize or Specified returned false
    • it is IxmlSerializable

提交回复
热议问题