How can i read binary data?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I store a serialized object in db as binary data. I want to read it and write
it to a byte array (byte[] xxx). I saw examples in forums, but all of them
write the data to a file on local drive. I want to read all the bytes and
serialize them to get the object without creating a file and writing data
into that file. How can i do that?

Thanks...
 
Here's a rough example :

public static object DeserialiseFromString(string s)

{

SoapFormatter bf = new SoapFormatter();

byte[] b = System.Text.Encoding.UTF8.GetBytes( s );

MemoryStream ms = new MemoryStream(b);

ms.Position = 0;

object o = bf.Deserialize(ms);

return o;

}



HTH, Adam.

=================
 
Thanks but i dont have problem in deserializing the byte[] data. I have
problem in reading binary data and writing it into byte array.
 
Back
Top