CSharp examples for System:Byte Array
Convert byte array To Single
using System.Text; using System;// www .jav a 2 s . c o m public class Main{ public static Single[] ToSingle(byte[] source, int sourceOffset, int size) { var arr = new Single[size]; for (int i = 0; i < size; i++) arr[i] = bitConverter.ToUInt16(source, sourceOffset + (i * sizeof(Single))); return arr; } public static UInt16[] ToUInt16(byte[] source, int sourceOffset, int size) { var arr = new UInt16[size]; for (int i = 0; i < size; i++) arr[i] = bitConverter.ToUInt16(source, sourceOffset + (i * sizeof (UInt16))); return arr; } }