Convert byte array to short array in C#

Create the short array at half the size of the byte array, and copy the byte data in:

short[] sdata = new short[(int)Math.Ceiling(data.Length / 2)];
Buffer.BlockCopy(data, 0, sdata, 0, data.Length);

It is the fastest method by far.

https://stackoverflow.com/questions/1104599/convert-byte-array-to-short-array-in-c-sharp

posted on 2018-02-03 15:49  积跬步---行千里  阅读(646)  评论(0编辑  收藏  举报