Visual Studio debugger - Displaying integer values in Binary

流过昼夜 提交于 2020-01-06 08:43:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!