Add DebuggerDisplay Attribute
Applies to: Visual Studio
Visual Studio for Mac
Visual Studio Code
This code generation applies to:
- C#
What: The DebuggerDisplay Attribute controls how an object, property, or field is displayed in the debugger variable windows.
When: You want to pin properties within the debugger programmatically in your code.
Why: Pinning properties allows you to quickly inspect objects by their properties by bubbling up that property to the top of the object's property list within the debugger.
How-to
Place your cursor on either a type, delegate, property, or field.
Press Ctrl+. to trigger the Quick Actions and Refactorings menu and select Add DebuggerDisplay attribute.
The DebuggerDisplay attribute will get added along with an auto method that returns the default ToString().
See also
Feedback
Submit and view feedback for