how to convert an sByte array to byte array

R

reju

I have to convert an sByte array to byte array.
This sbyte array contains some signed values due to this .net
converting functions will throw an exception.any work around for this?

is there any way to pass sbyte array to stream classes eg: memory
stream?
 
G

Guest

Howdy,

sbyte[] src = new sbyte[] { -1, 1, -2, 2 };
byte[] dest = new byte[src.Length];
System.Buffer.BlockCopy(src, 0, dest, 0, src.Length);
 
R

reju

Howdy,

sbyte[] src = new sbyte[] { -1, 1, -2, 2 };
byte[] dest = new byte[src.Length];
System.Buffer.BlockCopy(src, 0, dest, 0, src.Length);
--
Milosz

reju said:
I have to convert an sByte array to byte array.
This sbyte array contains some signed values due to this .net
converting functions will throw an exception.any work around for this?
is there any way to pass sbyte array to stream classes eg: memory
stream?


Great Milosz

it works
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top