As I said in the Part I, this time I will focus on the Hit Count property and the Conditions of breakpoints. If you go to the breakpoint's properties (right click on the breakpoint and choose Breakpoint properties... option) you will see two interesting options:
When we enable the Hit Count and give some positive integer value X the breakpoint will suspend the execution when it would be hit Xth time.
Lets illustrate this with example. If we consider the following code:
and we set the Hit count of the breakpoint (look at the picture above to see where the breakpoint is placed) to 7 we will find the following output in the Console view before the execution is suspended:
So as you can see the execution was suspended when the breakpoint was hit 7th time.
Sometime everyone faces the situation when we want a breakpoint to be active only if some condition is fulfilled (e.g. we go in the loop through a 1000 elements list o people's names and we want to debug this loop for a particular name and we don't want to go 1000 times through this loop). To see how it works let's take the same code and let's set the condition the following way:
In this case the output in the Console view will look as follows:
The given condition is evaluated in the context of the breakpoint, so we can use all the variables that are available the context. Of course you don't have to use the numerical conditions, any expression that gives boolean answer can be used!