Generating an Xml Serialization assembly for a custom XmlSerializer

后端 未结 2 983
孤街浪徒
孤街浪徒 2020-12-20 02:01

I have methods in my class for serializing/deserializing using a different XML structure than what would be produced with the default serializer. The methods create an XmlSe

2条回答
  •  自闭症患者
    2020-12-20 02:45

    (Not yet enough points to comment)

    You should consider biting the bullet and implement IXmlSerializable in a manner that allows you to decide what to serialize and what not, without changing attributes at runtime. Define your own attributes, constructor requirements and serialize them.

    Perhaps you could even sack XML-Serialization and switch to JSon.Net where the need to jump through such hoops is rather unlikely.

提交回复
热议问题