Properties are a great feature in .Net, no doubt. The only time I have a problem with them is when I have simple properties and I am stepping through code while debugging. Let me explain ... It so happens that while debugging, if you use F11 (Step Into), VS.Net will step into every property used as well. Many a times, this is a colossal waste of time, since I am fairly confident that the properties are simple and get/set correct values. I really need a way to force step over for these properties. Well guess what, there is a way. It's an attribute called 'System.Diagnostics.DebuggerStepThroughAttribute' that can be used with property get/set or even methods. When present, it will force the debugger to step over that property/method saving time and reducing debugging complexities. Here's the sample code :
1 public int Count
2 {
3 [DebuggerStepThroughAttribute]
4 get { return count; }
5 }
References MSDN Debuggerstepthroughattribute MSDN Debuggerstepthroughattribute Members


0 comments:
Post a Comment