Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Format Specifiers in C#

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not applyTopic appliesTopic does not applyTopic applies

Standard

Topic does not applyTopic appliesTopic does not applyTopic applies

Pro and Team

Topic does not apply

Topic applies

Topic does not applyTopic applies

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

When you debug 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. After the comma, add the appropriate specifier.

Suppose nVar is a character variable, and the Watch window shows the value as 0x0000F065. You want 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

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.

d

Decimal integer

0x0065

101

h

Hexadecimal integer

61541

0x0000F065

nq

String with No Quotes

"My String"

My String

hidden

Displays all public and non-public members

raw

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

results

Used with a variable of a type that implements IEnumerable or IEnumerable<T>, usually the result of a query expression. Displays only the members that contain the query result.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft