Does protobuf-net create a binary compatible with google settings

Actually I want to serialize my data using Java java implementation and then deserialize using C # implementation?
I chose protobuf-net as it seems to be more stable (proto # is still v0.9, or I would go for that). Before I start working on this, I wanted to be sure that I could do it (serialize the data using the java implementation and deserialize it using protobuf-net). Or is there a list of methods specific to the protobuf-net implementation?

+2


source to share


2 answers


If you need the same API across multiple platforms, Jon Skeet's implementation may be more appropriate for you. The difference is that protobuf-net is designed around common C # development patterns, for example it doesn't require you to use the generated types (you can use your own, just like you can with DataContractSerializer

, XmlSerializer

etc.) , - and it supports some BCL concepts directly.

Both should be 100% wire compatible, but there are a few API differences here :



  • direct support DateTime

    , TimeSpan

    , Guid

    etc. (described by contracts in bcl.proto in zip)
  • support for inheritance (displayed as nested data per wire)
  • support for your own types
  • support for mutable types (not a construction / immutable pair)
  • support for serialization callbacks
  • (maybe a few others - do you want a 100% complete list?)

The one you are most likely to notice is inheritance. Simple: don't use this if you plan on using interop. I've tried to make it very explicit in intellisense if you're doing something that will use .NET specific tricks, but if you start with .proto they still won't use them (it should be portable).

+2


source


All google serializations are wire-compatible, and while protobuf-net is not written by Google, claims it is wire-compatible .



Also, there is a C # Compatible API page linked from google documentation.

0


source







All Articles