How to serialize any object?

Hi
Can i serialize any poco object to type of xml, json or another. Is Reflection.Serialize() not imposible?

Thanks

I don’t think this is implemented in NETMF.

Goto http://code.tinyclr.com and search for json

Hımm, it’s great. Do you have json parser?

Always worth checking the WiKi.

If you are using one of GHI’s “smallest” offerings (e.g. Panda), serialization doesn’t work. You have to roll your own code.

Per: http://wiki.tinyclr.com/index.php?title=Serialization

For serialization on the Panda II (to send POCOs across a serial connection in my case) I’ve rolled my own. Basically, I have a Serialize() and Deserialize() method on an object where I turn it into a byte or rehydrate an object from a byte.

See:



Microsoft.SPOT.Hardware.Utility.ExtractRangeFromArray()
Microsoft.SPOT.Hardware.Utility.ExtractValueFromArray()
Microsoft.SPOT.Hardware.Utility.InsertValueIntoArray()

//convert a byte array to a string
char[] CharArray = System.Text.UTF8Encoding.UTF8.GetChars(somebyteArray);
string someString = new string(nameCharArray);

//convert a string to a byte array
byte[] someBytes = System.Text.Encoding.UTF8.GetBytes("Good Luck");