Convert byte array To UInt64 - CSharp System

CSharp examples for System:Byte Array

Description

Convert byte array To UInt64

Demo Code


using System.Text;
using System;//from  ww w .  j a  v  a2 s  . co  m

public class Main{
        public static UInt64[] ToUInt64(byte[] source, int sourceOffset, int size)
        {
            var arr = new UInt64[size];
            for (int i = 0; i < size; i++)
                arr[i] = bitConverter.ToUInt16(source, sourceOffset + (i * sizeof(UInt64)));
            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;
        }
}

Related Tutorials