Strategy for cross-language (java and c#) object serialization

前端 未结 9 653
梦毁少年i
梦毁少年i 2020-12-09 04:21

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 c

相关标签:
9条回答
  • 2020-12-09 05:17

    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.

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

    Small, fast, efficient, portable.

    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.

    0 讨论(0)
  • 2020-12-09 05:23

    Google's Protocol Buffers is something that you could look into. You will need to check into the state of the usability of the C# implementation, but in all other respects, I think that it meets your needs.

    0 讨论(0)
  • 2020-12-09 05:25

    You could try Hessian:

    http://hessian.caucho.com/index.xtp

    It's binary, and supports Java, C++, and several other languages. I've never used it myself, but came across it, thought it was interesting, and bookmarked it...

    0 讨论(0)
提交回复
热议问题