Kevin Driedger
Kevin Driedger

Reputation: 54202

How do I change the output in the debugger for a class?

The ToString() method for a class outputs the class information in the debugger but it has the unfortunate side effect of changing the output for the User Interface (UI). Is there an attribute that can be specified on the class?

Upvotes: 0

Views: 89

Answers (1)

Kevin Driedger
Kevin Driedger

Reputation: 54202

Use the attribute DebuggerDisplay

[DebuggerDisplay("AnyString: {MyVar}")]

This code will have the debugger for your class display:

AnyString: 12

where MyVar has been assigned the value 12.

Upvotes: 4

Related Questions