If you want to change the information, the debugger variable window shows for your class, you can use the DebuggerDisplayAttribute.
Simply put the Attribut above your class declaration. The Value between {} are the name of the property or Field you want to show.

Sample C#

[DebuggerDisplay("Name = {Name}, Value = {Value}")]

Sample VB.NET

<DebuggerDisplay("Name = {Name}, Value = {Value}")>

Result

DebuggerDisplayAttribute

for more informations see the DebuggerDisplayAttribute Class MSDN Entry

2 thought on “How to use DebuggerDisplayAttribute in C# and VB.NET”

Leave a Reply