DebuggerDisplayAttribute

The DebuggerDisplayAttribute class is defined in the System.Diagnostics namespace.

The DebuggerDisplayAttribute can be applied at Assembly, Class, Struct, Enum, Property, Field and Delegate level, it can be applied multiple times and can influence how data is displayed in the debugger variable window.

By default, when debugging, Visual Studio displays in the debugger variable window the result of ToString() call:

DebuggerDisplayAttribute_1

Sometimes it would be useful to have more information displayed in debugger variable window and this should occur without any changes to the ToString() method.

The DebuggerDisplayAttribute can be applied at class, at property or at field level, in order to display detailed information:

DebuggerDisplayAttribute_2

 

(A similar attribute, but with opposite meaning can be also investigated: DebuggerBrowsableAttibute)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s