C#

Using DebuggerBrowsable Attribute for a better view in debugger window

There are lots of small tricks in .net which can be very useful if used wisely. In this post I want to discuss the use of DebuggerBrowsableAttribute. Using this attribute you can control how a member of class will be displayed in debugger windows during debugging. Before that consider small example:




Lets create a instance of Organization and add some sample data:

Now when you run this program in debug mode and try to view the org in debugger window it will look like this:

Lets try to change it using DebuggerBrowsableAttribute. Make following changes by adding DebuggerBrowsableAttribute:

Again run this program in debug mode and try to view the org in debugger window. Now it will look like this

You can see how this small but useful attribue can change the look of the debugger window.

About the author

admin

Leave a Comment