DataContractSerializer is missing in the .NET Compact Framework

It appears that the DataContractSerializer is not available in the .NET Compact Framework. I found this rather unexpected as I consider the DataContractSerializer the “Holy Grail of Serialization” and one of the most useful classes implemented in .NET 3.

Is there a way to get the same functionality within the Compact Framework, that is, the ability to easily save and restore real-world graphic objects using a text format?

I would prefer to stay away from old, limited .NET serializers like XmlSerializer and BinarySerializer.

I think maybe there is a custom implementation of DataContractSerializer available, or maybe you can use code from Mono? Has anyone tried to do this?

+3
source share
3 answers

Is it available in CF 3.5? (edit: no, I checked - really, it’s not). I know that XmlSerialzier is, but yes, it has some limitations.

Do I need to be text? Protobuf-net option that works on CF2.0, CF3.5, Silverlight, Mono, .NET 2.0, etc .; and includes everything you usually need (including callbacks, etc.).

By the way, the Mono code (from "Olive"), last time, I looked, is not very complete ...

(edit) Json.NET; , CF; JSON, , .

+3

, XmlSerializer "". ? ? ?

, XmlSerializer , DCS. DCS , , , . , DCS , XmlSerializer - .

XmlSerializer , .

0

: -)

There's a great XML serializer at http://www.codeproject.com/KB/XML/GR_CustomXmlSerializer.aspx .

As in the case of the Compact Framework, the code does not work, but I made a few trivial settings to make it work, with only a slight loss of functionality. I also used OpenNetCF to fill out several missing parts of CF.

0
source

Source: https://habr.com/ru/post/1704383/


All Articles