Main Site Documentation

Need a Cross PC/NETMF class Serialize/Deserialize mtehod


#1

Hi All,

Does any one can confirm if serializing a class in .NET will be compliant with deserializing it in NETMF and vice versa…

I need to transfer datas between a ‘server’ and my G120 using this pattern, but I remember to have read some things about related problems on that key point on the forum couple of month ago…

Thanks for your fedback.


#2

Oups… And HAPPY NEW YEAR TO EVERYONE !!!


#3

I’ve read somewhere that at least on netmf side the exact assembly version is stored in the data.
So assembly name and exact version must match.
But it’s also not too hard to write your own serializer/deserializer using reflection.

forarch(var prop in obj.GetType().GetProperties(...))
{
   <serialize>prop.GetValue(obj);
or
   prop.SetValue(obj, <deserialize>);
}

It’s the same on both sides, so you could use (al least nearly) the same code,

btw. you could also serialize fields or a custom list of properties.
Also looking at the attributes is possible. Just check out “.net Reflection” on google to find out more. Most of the stuff works in netmf too. But some of the overloads and wrapper methods are missing.


#4

May be this can be useful:

https://www.ghielectronics.com/community/codeshare/entry/464

I’ve used many times for classes serialization between PC and NETMF.


#5

@ dobova -

Thanks, I will have on look on it next week !