Example for serialization
// Convert an object to a byte array private byte[] ObjectToByteArray(Object obj) { if(obj == null) return null; BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, obj); return ms.ToArray(); } // Convert a byte array to an Object private Object ByteArrayToObject(byte[] arrBytes) { MemoryStream memStream = new MemoryStream(); BinaryFormatter binForm = new BinaryFormatter(); memStream.Write(arrBytes, 0, arrBytes.Length); memStream.Seek(0, SeekOrigin.Begin); Object obj = (Object) binForm.Deserialize(memStream); return obj; }
Simple example for converting objects into byte arrays aka serialization. For custom classes add [Serializable] attribute to enable serialization.
Anonymous on Mar 15, 2010
lppi7w <a href="http://hdzncitskzfm.com/">hdzncitskzfm</a>, [url=http://hybwaymlzzhw.com/]hybwaymlzzhw[/url], [link=http://jqjgtbdhztqs.com/]jqjgtbdhztqs[/link], http://hpztzlldlpzf.com/
Anonymous on Jun 10, 2010
wIrPTA <a href="http://stpoijifsinu.com/">stpoijifsinu</a>, [url=http://meqlohxcythr.com/]meqlohxcythr[/url], [link=http://ojtrpppmuufi.com/]ojtrpppmuufi[/link], http://xdaxpeyovvpv.com/