byte array To Double array - CSharp System

CSharp examples for System:Byte Array

Description

byte array To Double array

Demo Code


using System.Text;
using System;/* ww w  . j a va2 s  . co m*/

public class Main{
        public static Double[] ToDouble(byte[] source, int sourceOffset, int size)
        {
            var arr = new Double[size];
            for (int i = 0; i < size; i++)
                arr[i] = bitConverter.ToInt16(source, sourceOffset + (i * sizeof(Double)));
            return arr;
        }
        public static Int16[] ToInt16(byte[] source, int sourceOffset, int size)
        {
            var arr = new Int16[size];
            for (int i = 0; i < size; i++)
                arr[i] = bitConverter.ToInt16(source, sourceOffset + (i * sizeof(Int16)));
            return arr;
        }
}

Related Tutorials