Most people set break points, and iterate through code until they find the condition they were looking for. Although (IMHO) poorly documented, it's possible to place a condition on your breakpoint to have it stop when your condition is met.
Let's look at this code:
20 int maxIdx = 15;
21 for(int idx=1; idx < maxIdx; idx++)
22 {
23 Response.Write("Index:" + idx.ToString());
24 }
If I were to place a breakpoint on line 23, the debugger would stop every time it hit the Response.Write. For a small loop that *might* be ok, but let's say I notice something weird with the 13th item. Within the breakpoint itself, I can place a condition when I actually want it to stop, in this case, the 13th iteration.
By right clicking on the debug "circle", the following context-sensitive menu comes up:
Select "Condition" and the following dialog appears:
In the textbox, place the condition that you want. In this case, when idx == 13, the condition is true, and therefore, the breakpoint will now be active and execution will stop.
When a condition for a breakpoint is set, you'll notice the image for the breakpoint changes as well:
Powered by: newtelligence dasBlog 2.3.9074.18820
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, © Copyright 2010
E-mail