Share via


Format Specifiers in C# 

When debugging C# code in the Watch window or QuickWatch dialog box, you change the format in which a value is displayed using format specifiers.

To use a format specifier, type the expression followed by a comma, and followed by the appropriate specifier.

Example

Suppose nVar is a character variable, and the Watch window shows the value as 0x0000F065. You would like to see this value as decimal, but you do not want to reset the display of all variables to decimal. You can use the format specifier d to show the variable contents in decimal:

nVar,d

The following table shows the C# format specifiers recognized by the debugger.

Specifier Format Value Displays

d

Decimal integer

0x0065

101

h

Hexadecimal integer

61541

0x0000F065

nq

String with No Quotes

"My String"

My String

private

Displays item as it appears in the private members node

raw

Displays item as it appears in the raw item node. Valid on proxy objects only.

Ac

Force evaluation of an expression. This can be useful when implicit evaluation of properties and implicit function calls is turned off. See Side Effects and Expressions.

See Also

Tasks

How to: Watch an Expression in the Debugger

Other Resources

Variable Windows