Question: Is there a more efficient way to convert byte array to int16 array ?? or is there a way to use Buffer.BlockCopy to copy evry two byte to int16 array ???

```
public static int[] BYTarrToINT16arr(string fileName)
{
try
{
int bYte = 2;
byte[] buf = File.ReadAllBytes(fileName); 
int bufPos = 0;
int[] data = new int[buf.Length/2];
byte[] bt = new byte[bYte];
for (int i = 0; i < buf.Length/2; i++)
{
Array.Copy(buf, bufPos, bt, 0, bYte);
bufPos += bYte;
Array.Reverse(bt);
data[i] = BitConverter.ToInt16(bt, 0);
}
return data;
}
catch
{
return null;
}
}   

```

Answer: 
This works if you don't mind using interopservices. I assume it is faster than the other techniques.

```
using System.Runtime.InteropServices;   

public Int16[] Copy_Byte_Buffer_To_Int16_Buffer(byte[] buffer)

{
    Int16[] result = new Int16[1];
    int size = buffer.Length;
    if ((size % 2) != 0)
    {
        /* Error here */
        return result;
    }
    else
    {
        result = new Int16[size/2];
        IntPtr ptr_src = Marshal.AllocHGlobal (size);
        Marshal.Copy (buffer, 0, ptr_src, size);
        Marshal.Copy (ptr_src, result, 0, result.Length);
        Marshal.FreeHGlobal (ptr_src);
        return result;
    }
}

```
```
var bytes = File.ReadAllBytes(path);

var ints = bytes.TakeWhile((b, i) => i % 2 == 0).Select((b, i) => BitConverter.ToInt16(bytes, i));

if (bytes.Length % 2 == 1)
{
    ints = ints.Union(new[] {BitConverter.ToInt16(new byte[] {bytes[bytes.Length - 1], 0}, 0)});
}

return ints.ToArray();

```