Is there a C# function that formats a 64bit "Unsigned" value to its equivalent binary value?
You can call it unsigned or signed, but its the same if you look at it bitwise!
So if you do this:
Convert.ToString((long)myNumber,2);
you would get the same bits as you would if there were ulong implementation of Convert.ToString(), and thats why there is none... ;)
Therefore, ((long)-1)
and ((ulong)-1)
looks the same in memory.
Unfortunately there's no direct .NET equivalent like Convert.ToString(ulong, int). You'll have to make your own, like the following:
public static string ConvertToBinary(ulong value){
if(value==0)return "0";
System.Text.StringBuilder b=new System.Text.StringBuilder();
while(value!=0){
b.Insert(0,((value&1)==1) ? '1' : '0');
value>>=1;
}
return b.ToString();
}