Interesting Links

I recently came across this gem on Hatim’s Development Blog.  It’s a post titled 5 Very Useful C# Attributes.

I’m really impressed with his example of the DebuggerDisplayAttribute. Very useful if you don’t want to keep drilling down while debugging.

 

DebuggerDisplayAttribute

Namespace: System.Diagnostics

Usage: The DebuggerDisplayAttribute can be a sweet shortcut to avoid expanding the object to get to the value of a given property when debugging. All you have to do is mouse over the object and any property defined in the attribute will show up with it’s value.

image

Sample:

[DebuggerDisplay("ProductName = {ProductName},ProductSKU= {ProductSKU}")]
public class Product
{
    public string ProductName { get; set; }
    public string ProductSKU { get; set; } 
}

Advertisement
Tagged , ,

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 )

Connecting to %s

%d bloggers like this: