Casting a Ulong from mutliple bytes  
Author Message
Lamprey_





PostPosted: Visual C# Language, Casting a Ulong from mutliple bytes Top

Hi,

I am trying to find a way (and the most efficient way) to cast a ulong (64 bit unsigned integer) from mutliple bytes.

For example, I have a byte array rawData[50], and I need to take bytes 0-7 and cast into a single ulong.

In psuedo-code , ulong myLongInt = (ulong)rawData[0:7].

Best practice for something like this



Visual C#8  
 
 
James Curran





PostPosted: Visual C# Language, Casting a Ulong from mutliple bytes Top

ulong myLongInt =BitConverter.ToUInt64(rawData, 0);

 
 
Lamprey_





PostPosted: Visual C# Language, Casting a Ulong from mutliple bytes Top

Thanks,

I found this in MSDN like 2 minutes after I posted.