November 19, 2009

Debugger/Editor Attributes

DebuggerDisplay - Use it to specify how a class or struct should be displayed in the debugger when the cursor hover over the item
[DebuggerDisplay("Count = {count}")]
class blahblahblah ...
DebuggerStepThrough - Instructs the debugger to step through that marked property or attribute, and not into it:
public int Key
  get { return key; }
  set { key = value; }
DebuggerBrowsable - Determines if and how a field or property is displayed in the debugger variable windows.
private int key;
see also DebuggerDisplay and DebuggerBrowsable – Two Debugger Attributes you should know

EditorBrowsable - Use this 'EditorBrowsable' property to restrict intellisense/visual studio visibility of a property
int MyProperty

DefaultValue - Then there is the 'DefaultValue' property that sets the default value of a C# class property. Used by visual designers, etc
public int MyProperty { get; set; }

No comments: