Serialization of objects in C #
is the easiest way to serialize and deserialize an array of bytes into an instance of a class: public Object
Desierializza (Byte [] bytes) {
System.IO.Stream s = new System.IO.MemoryStream (statistic.DbParameter)
s.Write (bytes, 0, bytes.Length)
BinaryFormatter bf = new BinaryFormatter ();
return bf.Deserialize(s);
}
public Byte[] Serializza(Object o)
{
System.IO.Stream s = new System.IO.MemoryStream(statistic.DbParameter);
BinaryFormatter bf = new BinaryFormatter();
return bf.Serialize(s, o);
}
0 comments:
Post a Comment