ssdjgru1
asked on
byte to byte[]
I am programming a modem communication software and I am receiving data as byte values (one by one) Is there any possibility to append each byte value to the end of some byte array, preferably not fixed in size ? (I know it is possible if I append bytes as characters to some string and then use encoding.getbytes from it ...but there is a problem - ENCODING = CONVERT > scrambling of some byte values above 128).
Thank you!
Thank you!
ASKER
byteArrayList.ToArray(type of(byte)); - Returns system.array, not byte[]
System.Collections.ArrayLi st byteArrayList = new System.Collections.ArrayLi st();
byte myByte = 1;
byteArrayList.Add(myByte);
byte[] bytesArray = new byte[byteArrayList.Count];
byteArrayList.CopyTo(bytes ,0);
byte myByte = 1;
byteArrayList.Add(myByte);
byte[] bytesArray = new byte[byteArrayList.Count];
byteArrayList.CopyTo(bytes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ArrayList allTheBytes = new ArrayList();
allTheBytes.add(recievedBy te);
(byte[])allTheBytes.ToArra y(typeof(b yte));
allTheBytes.add(recievedBy
(byte[])allTheBytes.ToArra
byte myByte = 1;
byteArrayList.Add(myByte);
byte[] bytesArray = byteArrayList.ToArray(type