Convert 64-bit binary to long equivalent

How can we convert the following 64-bit binary to a 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: A large binary number is currently stored as a string. So this is the string for the long conversion I'm looking for.

+3
source share
1 answer

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/

In particular (where bin is a binary string):

long l = Convert.ToInt64(bin,2);
+7
source

Source: https://habr.com/ru/post/1742118/


All Articles