BinaryFormatter alternative

自古美人都是妖i 提交于 2019-12-01 21:46:33

I have since learned that protobuf-net will respect the [DataContract] and [DataMember] attributes (no .protos required) so if your classes are WCF-ready or you want to decorate them with aforementioned attributes then you can use protobuf-net out of the box for your classes.

Some work is obviously required to decorate all your classes (v1 of protobuf requires this) however I understand v2 will be able to able to build the model for your undecorated classes.

For backwards compatibility handling: Use any of the IFormatter.Binder, ISerializationSurrogate, OptionalFieldAttribute, IDeserializationCallback API's.

For speed: Try the Gramma.Serialization's FastBinaryFormatter, a replacement for BinaryFormatter, implementing the IFormatter interface, honoring all standard .NET serialization constructs including the above mentioned.

There's also Proto# and dotnet-protobufs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!