Converting Object into Byte[]

  • Thread starter Thread starter santhi
  • Start date Start date
S

santhi

Hi,

Pls Anyone guide me how to convert object into byte[].

I'm storing the Byte[] with id in the hashtable and while retrieving i'm
trying to put the Hashtable value into Byte[] back.But i'm not sure how to
do that convertion (ie object to byte[]).

eg
Hashtable ht = new Hashtable();
Byte[] res = new Byte[];
res = //Some value;
ht.Add(1,res);

while retirving i want to put into the byte array back.



Thanks,
Santhi
 
Hi,

Pls Anyone guide me how to convert object into byte[].

I'm storing the Byte[] with id in the hashtable and while retrieving i'm
trying to put the Hashtable value into Byte[] back.But i'm not sure how to
do that convertion (ie object to byte[]).

eg
Hashtable ht = new Hashtable();
Byte[] res = new Byte[];
res = //Some value;
ht.Add(1,res);

while retirving i want to put into the byte array back.

Cast it:

res = (byte[]) ht[1];
 
Back
Top