Get Bytes from short type array - CSharp System

CSharp examples for System:Byte Array

Description

Get Bytes from short type array

Demo Code


using System;//  www.  j av  a  2s .c  o  m

public class Main{
        public static void GetBytes(short[] input,int count,byte[] output)
        {
            for (var i = 0; i < count; ++i )
            {
                var bytes = BitConverter.GetBytes(input[i]);

                output[i * 2] = bytes[0];
                output[i * 2 +1] = bytes[1];
            }
        }
}

Related Tutorials