谷歌的协议缓冲器在C# [英] Google's Protocol Buffers in c#

查看:93
本文介绍了谷歌的协议缓冲器在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在考虑使用谷歌的协议缓冲器来处理通过网络C ++应用程序和C#应用程序之间的序列化。



我的问题是,我发现一对夫妇不同verisions为C#。这两个看起来不错,但是,没有人知道这两个



之间有什么不同(如果有的话)

  1. protobuf-net

  2. jskeet / DOTNET-protobufs


解决方案

当然, DOTNET-protobufs是Java版本的端口,因此股价非常类似的API和方法的核心谷歌执行情况; 。代码宝石,不变性等



protobuf网是字节兼容,但它是一个完整的从划痕的重新实施,以下标准的.NET成语 - 如此熟悉到XmlSerializer的等用户它也可以对可变对象(和不可改变根据设定,并在V2结构),并具有WCF,远程等可选挂钩。



两者都可以从.proto工作(可以说DOTNET-protobufs是的更好的这个比protobuf网);但protobuf网可以对着干现有的.NET POCO / DTO等不.proto或任何代码生成。



此外,protobuf网报价之类的东西继承支持,但你可能不选择使用,在您的情况,因为它不一样容易映射到.proto定义。


We are looking at using Google's Protocol Buffers to handle serialization between a c++ application and a c# application via networking.

My question is, I've found a couple of different verisions for c#. Both look pretty good, however, does anyone know what is different (if anything) between the two

  1. protobuf-net
  2. 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; 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.

Both can work from .proto (arguably dotnet-protobufs is better at this than protobuf-net); but protobuf-net can work against existing .net poco/DTO etc without .proto or any codegen.

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.

这篇关于谷歌的协议缓冲器在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆