Serialization byte array vs XML file

前端 未结 7 1867
礼貌的吻别
礼貌的吻别 2021-01-06 08:42

I am heavily using byte array to transfer objects, primitive data, over the network and back. I adapt java\'s approach, by having a type implement ISerializable, which cont

7条回答
  •  广开言路
    2021-01-06 09:06

    If you are after simple, lightweight and efficient binary serialization, consider protobuf-net; based on google's protocol buffers format, but implemented from scratch for typical .NET usage. In particular, it can be used either standalone (via protobuf-net's Serializer), or via BinaryFormatter by implementing ISerializable (and delegating to Serializer).

    Apart from being efficient, this format is designed to be extensible and portable (i.e. compatible with java/php/C++ "protocol buffers" implementations), unlike BinaryFormatter that is both implementation-specific and version-intolerant. And it means you don't have to mess around writing any serialization code...

提交回复
热议问题