Visual Studio debugger - Displaying integer values in Hex

Solution 1:

Right-click your Watch Window or Immediate Window and uncheck Hexadecimal Display option.

enter image description here

Solution 2:

You can also choose hexadecimal or decimal display on a per-variable basis in the Visual Studio watch window by appending a debugger format specifier to the variable name. In the watch window, enter:

myInt,h
myInt,d

The other very useful format specifiers are ac (see footnote) for 'always calculate', and nq for displaying with 'no quotes.' They can be used together:

my_string_func(),ac,nq

nq is useful inside DebuggerDisplay attributes, which can appear on a class:

[DebuggerDisplay("{my_string_func(),nq}")]
class MyClass
{
    /* ...example continues below... */

...or on one or more field(s) inside a class:

    [DebuggerDisplay("{some_field,nq}", Name="substitute name here")]
    int an_integer;

    [DebuggerBrowsable(DebuggerBrowsableState.Never)]
    String some_field;
}

http://msdn.microsoft.com/en-us/library/e514eeby(v=VS.100).aspx

  • note that earlier versions of the MSDN doc page incorrectly said 'Ac' (with a capital 'A')--which doesn't work