de serialisation

  • Thread starter Thread starter Ken Foskey
  • Start date Start date
K

Ken Foskey

I have looked up and comments about registering deserialise I have no
idea how to go about this. Seems to be a generic C# tool but I cannot
get the right google search and C# cookbook + c# 3.0 does not clue me in.

I am serialising with Jayrock JSON and I want to reverse the process but
it needs hand tuned code to implement correct business logic after
transmission. For example I am serialising a DataRow and you cannot undo
this because it does not have a default constructor. How do I take
control of the deserialise?

Thanks Ken
 
Probably I do understand your problem wrong, however does this helps you.

\\\
private string SerializeArraylist(ArrayList arraylst)
{
BinaryFormatter bf = new BinaryFormatter();
MemoryStream mem = new MemoryStream();
bf.Serialize(mem, arraylst);
return Convert.ToBase64String(mem.ToArray());
}
private ArrayList DeserializeArraylist(string arraystring)
{
BinaryFormatter bf = new BinaryFormatter();
MemoryStream mem = new
MemoryStream(Convert.FromBase64String(arraystring));
return (ArrayList)bf.Deserialize(mem);

}
///

Be aware that a DataRow has references to a DataTable for the column (item)
properties, therefore serializing a datarow alone makes not much sense. But
there is probably nothing more easily to serialize and deserialize then a
datarow in a DataSet (by instance with 1 table and 1 row).

Cor
 
Back
Top