public static short[] ByteArrayToShorts(byte[] buffer, int offset, int count) { int shortCount = count / sizeof(short); short[] shorts = new short[shortCount]; Buffer.BlockCopy(buffer, offset, shorts, 0, shortCount * sizeof(short)); return shorts; }