策略跨语言(Java和C#)对象序列化 [英] Strategy for cross-language (java and c#) object serialization

查看:140
本文介绍了策略跨语言(Java和C#)对象序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个项目,我需要序列化在Java 6的应用程序的一些数据和反序列化一个C#2.0的应用程序。是否有一个战略或存在的东西我已经可以看看,让我用这两种语言做到这一点?我猜他们都支持XML序列化,但我真的需要它是二进制序列化。

I'm working on a project where I'll need to serialize some data in a java 6 app and deserialize it a c# 2.0 app. Is there a strategy or something already in existence I can look at that would allow me to do this with these two languages? I'm guessing they both support XML serialization but I really need it to be binary serialized.

推荐答案

协议缓冲区会在这里一个不错的选择。在C#的一面,我会建议乔恩斯基特的 DOTNET-protobufs 的这个用例,因为它具有在两侧相同的API(他的C#版本是的谷歌Java版本的端口,核心分配的一部分)。如果你想在C#中更典型的.NET,然后 protobuf网可以帮助

Protocol buffers would be a good option here. On the C# side, I would recommend Jon Skeet's dotnet-protobufs for this use-case, since it has the same API on both sides (his C# version is a port of the Google Java version, part of the core distribution). If you want the C# to be more "typical .NET", then protobuf-net may help.

(钢丝格式版本之间明显相同的;该API可能会有所不同)

(the wire format is obviously identical between versions; the API may vary)

小,速度快,效率高,便携式

Small, fast, efficient, portable.

有关信息,我的知道的那个protobuf网拥有.NET 2.0的支持;老实说,我还没有试过这种对乔恩的版本,但我的期望的它会 - 没有太多,你需要3.0 / 3.5在protobuf的

For info, I know that protobuf-net has .NET 2.0 support; I honestly haven't tried this on Jon's version, but I expect it would - there isn't much that you need 3.0/3.5 for in protobuf.

这篇关于策略跨语言(Java和C#)对象序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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