You can't convert an array type; however:
byte[] bytes = ...
double[] values = new double[bytes.Length / 8];
for(int i = 0 ; i < values.Length ; i++)
values[i] = BitConverter.ToDouble(bytes, i * 8);
or (alterntive):
byte[] bytes = ...
double[] values = new double[bytes.Length / 8];
Buffer.BlockCopy(bytes, 0, values, 0, values.Length * 8);
should do. You could also do it in unsafe
code:
byte[] bytes = ...
double[] values = new double[bytes.Length / 8];
unsafe
{
fixed(byte* tmp = bytes)
fixed(double* dest = values)
{
double* source = (double*) tmp;
for (int i = 0; i < values.Length; i++)
dest[i] = source[i];
}
}
not sure I recommend that, though
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…