Click to Rate and Give Feedback

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio Debugger
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.

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.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker