by michel
10. October 2008 16:01
I love to check out somebody else his or her code. I always learn something from it. Just a couple of days ago I had an example from Scott Allen about WWF and ASP.Net.
In his code example I found a class with different small data checks. Each static method was decorated with the ´DebuggerStepThroughAttribute´.
public static class Check
{
[DebuggerStepThrough]
public static void IsNotNull(object argument, string message)
{
if (argument == null)
{
throw new InvalidOperationException(message);
}
}
}
|
| Scott Allen, source code example |
Not exactly knowing what the attribute meant (besides what the name is telling you) triggered me to ask it Google :)
By placing System.Diagnostics.DebuggerStepThrough attribute above a method, you instruct the debugger to step through that method and not into it. With other words this instruction will cause the debugger not to step into method as normal, but you can always place a breakpoint in that method and stop there.
Hmm sweet isn't it :) Hopefully it's useful for you as well.
[kickit]