Thanks for pointing me to the buffer.bloackcopy. I wrote some sample code to
test how it works, I basically defined an array of double and coverted it to
byte array and finally converted the byte array back to an array of double.
What I noiced is that when I converted the byte array back to double, it
retuned an array of double which had more elements that the original array of
double. See the sample code below, any suggestions on how to get the original
double array back.
Dim dblarr() As Double = {2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0}
Dim test() As Byte = Array.CreateInstance(GetType(Byte),
Buffer.ByteLength(dblarr))
'Now copy the bytes from the double array to the byte array.
Buffer.BlockCopy(dblarr, 0, test, 0, Buffer.ByteLength(dblarr))
'Create a new double array to convert the byte array back to double
array
Dim dblNew() As Double = Array.CreateInstance(GetType(Double),
Buffer.ByteLength(test))
'Copy the bytes from byte array back to double array
Buffer.BlockCopy(test, 0, dblNew, 0, Buffer.ByteLength(test)) --->
This returned a double array of length 80, the first 10 elements returned
were correct, the rest of the 70 elements were 0s.
I hope I am clear.
Thanks