且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Silverlight中序列化派生类

更新时间:2023-02-15 15:23:34

我认为您***在这里实现IXmlSerializable,因为您确实不希望滥发地序列化基类中的所有内容(而且我不相信您坦率地说可以.

I think you are better off implementing IXmlSerializable here, as you really don't want to indiscriminately serialize everything in the base class (and I don't believe you can, quite frankly).

相反,在MyCustomClass上实现IXmlSerializable,然后DataContractJsonSerializer将能够使用该实现向JSON序列化/从JSON序列化.

Rather, implement IXmlSerializable on MyCustomClass, and then the DataContractJsonSerializer will be able to use that implementation to serialize to/from JSON.