Convert 64bit Binary to Long equivalent
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.
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);
精彩评论