简体   繁体   English

c#中的Google协议缓冲区

[英]Google's Protocol Buffers in c#

We are looking at using Google's Protocol Buffers to handle serialization between a c++ application and ac# application via networking. 我们正在考虑使用Google的Protocol Buffers来处理c ++应用程序和ac#应用程序之间的序列化。

My question is, I've found a couple of different verisions for c#. 我的问题是,我已经为c#找到了几个不同的修改。 Both look pretty good, however, does anyone know what is different (if anything) between the two 两者看起来都不错,但是,有没有人知道两者之间有什么不同(如果有的话)

  1. protobuf-net protobuf网
  2. jskeet / dotnet-protobufs jskeet / dotnet-protobufs

Sure; 当然; dotnet-protobufs is a port of the java version, so shares a very similar API and approach to the core google implementation; dotnet-protobufs是java版本的一个端口,所以共享一个非常类似的API和核心谷歌实现的方法; code-gem, immutability, etc. 代码宝石,不变性等

Protobuf-net is byte compatible, but is a complete from-scratch re-implementation, following standard .NET idioms - so is familiar to users of XmlSerializer etc. It also works against mutable objects (and immutable depending on the setup, and structs in v2), and has optional hooks for WCF, remoting, etc. Protobuf-net是字节兼容的,但是遵循标准的.NET惯用语是一个完整的从头开始重新实现 - 因此对XmlSerializer等用户来说很熟悉。它也可以对抗可变对象(并且根据设置和结构不可变) v2),并有可选的WCF钩子,远程处理等。

Both can work from .proto (arguably dotnet-protobufs is better at this than protobuf-net); 两者都可以从.proto工作(可以说dotnet-protobufs在这方面比protobuf-net 更好 ); but protobuf-net can work against existing .net poco/DTO etc without .proto or any codegen. 但是protobuf-net可以在没有.proto或任何codegen的情况下对现有的.net poco / DTO等起作用。

Additionally, protobuf-net offers things like inheritance support, but you might not choose to use that in your scenario as it doesn't map as easily to .proto definitions. 另外,protobuf-net提供了诸如继承支持之类的东西,但是你可能不会选择在你的场景中使用它,因为它不容易映射到.proto定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM