views:

112

answers:

1

How can we convert the following 64 bit binary into the long equivalent;

01111101 10100011 01001111 11111111 11111111 11111111 11111111 11000000  
equals 7D A3 4F FF FF FF FF C0 HEX  
equals 9053167636875050944    << this is the value we want in a C# variable 

EDIT: The large binary number is currently stored as a String. So its a string to long conversion that I am looking for.

+2  A: 

Here you go: http://msdn.microsoft.com/en-us/library/system.convert.toint64.aspx

And examples here: http://www.csharphelp.com/2007/09/converting-between-binary-and-decimal-in-c/

Specifically (where bin is a 'binary' string):

long l = Convert.ToInt64(bin,2);
zaf
Arg! I keep forgetting `Convert`! +1
Daren Thomas