public static byte[] ToByteArray(this Int32[] int32Array) { ArrayTypeConverter typeConvert = new ArrayTypeConverter { Int32s = int32Array }; byte[] bytes = new byte[int32Array.Length * 4]; Buffer.BlockCopy(typeConvert.Bytes, 0, bytes, 0, bytes.Length); return(bytes); }
public static byte[] ToByteArray(this short[] shortArray) { ArrayTypeConverter typeConvert = new ArrayTypeConverter { Shorts = shortArray }; byte[] bytes = new byte[shortArray.Length * 2]; Buffer.BlockCopy(typeConvert.Bytes, 0, bytes, 0, bytes.Length); return(bytes); }
public static byte[] ToByteArray(this float[] floatArray) { ArrayTypeConverter typeConvert = new ArrayTypeConverter { Floats = floatArray }; byte[] bytes = new byte[floatArray.Length * 4]; Buffer.BlockCopy(typeConvert.Bytes, 0, bytes, 0, bytes.Length); return(bytes); }