Replacement for XML Serialization

后端 未结 6 2077
梦毁少年i
梦毁少年i 2020-12-24 13:17

I have code using XmlSerializer to serialize/deserialize a data structure for persistance. I\'ve read and heard in several places here on StackOverflow that

6条回答
  •  甜味超标
    2020-12-24 13:31

    XmlSerializer is perfectly supportable, but has some glitches;

    • relatively slow; but usually this is still fast enough
    • only supports public members; can be a pain
    • requires write accessors lists - just ugly

    However, I expect it to continue to be there for a considerable time; IMO, it is BinaryFormatter that has the real problems (when used for persistence).

    I'm very biased (since I'm the author), but I'd choose protobuf-net; a binary serializer using Google's "protocol buffers" wire format; fast, portable between languages/platforms, very small output, version tolerant, etc (and free, of course). Clearly not xml, though - so not human readable.

提交回复
热议问题