问题
I'm using Visual Studio 2017 and I need to look at the binary representation of integer variables.
How can this be achieved from the Visual Studio debugger?
回答1:
Type 'var, b' in the watch, for example,
回答2:
Right-click the value it’ll show a menu list, but it only give us the option of Hexadecimal Display. To display the variable with binary value in watch window, I suggest you write function to covert it :
The function that in my code is:
public static string ToBinaryString(uint num)
{
return Convert.ToString(num, 2).PadLeft(32, '0');
}
来源:https://stackoverflow.com/questions/47904471/visual-studio-debugger-displaying-integer-values-in-binary