Question

I am working on Xamarin iOS application. I also want to develop the same application for Android as well. So I am planning to write most of the code in a portable class library project.

The issue that I am facing now is, I cannot serialize the object of the class that created inside the “Portable class library” project. The “[Serializable]” attribute not supported inside the portable class library. I want to implement binary format serialization inside the portable class library project . How I achieve this.

Any help would ne appreciable.

Was it helpful?

Solution

I would strongly suggest not using the built-in binary serialization even if you could... and it sounds like basically can't anyway. There are plenty of alternatives for serialization, depending on your requirements. You could consider:

  • JSON (e.g. with Json.NET)
  • Protocol Buffers
  • YAML
  • XML

These have different trade-off in terms of whether you need to make the data that you're serializing separate to your normal code or whether they can serialize "in-place", the readability, efficiency etc. But all are nice and portable, not just between .NET/Xamarin implementations but also other platforms.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top