Click here to Skip to main content
15,891,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing an app which I would like to be able to send data in a single file to a windows embedded device so this rules out BinaryFormatting, however I am having problems with XML Object serialization not allowing me to serialize a byte array.

Can any body point me in the direction of some good examples/tutorials

Cheers
Posted
Comments
Sergey Alexandrovich Kryukov 25-Jun-12 15:29pm    
"I'm having problems" is not descriptive. What problems, more exactly?
--SA
tiggerc 25-Jun-12 16:17pm    
The xml serialisation will not serialize a byte array, and the ms documentation is for rocket scientists. So rather than ask someone to code for me, i was trying to get some pointers to some humble human guides.

Medhi has pointed me at something that works but i would like to learn more about serialization. I can use the serialization in the full blown framework alright, was just struggling with. Net compact framework
Sergey Alexandrovich Kryukov 29-Jun-12 20:05pm    
Thank you for clarification. Now you get an alternative answer from me. Pay attention -- it has many benefit and is easiest to use, ever, and at the same time is quite comprehensive and universal.
--SA

You can Convert.ToBase64String() your byte[] data as a work around.

Depending on your .net framework completeness on Windows Embedded you can try fastJSON[^], although the fast reflection does not work on the compact framework as it is not there.

There are other serializers which work on WinCE which may not be polymorphic like fastJSON (if you need it) like : http://www.sharpserializer.com/en/index.html[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Jun-12 20:04pm    
Good, my 5.
Please see another alternative in my answer.
--SA
In addition to the solution by Mehdi: you also can use Data Contract. What's good about it is: it's the easiest to use because it is non-intrusive: you have your data types intact, only add attributes to required types/members. Please see:
http://msdn.microsoft.com/en-us/library/ms733127.aspx[^].

Please see my past answers advocating this approach with some more detail:
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating property files...[^],
deseralize a json string array[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900