Lets finish this year with one of the handy and time saving option available in visual studio i.e.set condition on breakpoint.
it is very handy and crucial time saver when your code contain very long iteration or loop and you want breakpoint would be break on certain condition only.
Lets understand this with actual example.suppose I would like to debug following code.
for (int i = 0; i < 10; i++)
Console.WriteLine("i is " + i);
Now, i want only debugger hit only when i is equal to 4.
Lets find out how we can achieve it.
- right click on breakpoint on which you would like to set condition and click on Condition option .
2. set the appropriate condition. for understanding purpose, i have set condition i==4.
3. now start the debugging. now you will noticed that breakpoint will hit only one time I.e. when i is equal to 4. not every time or not throughout iteration (for loop).
Hope this will help you.
Reply and suggestions are warmly appreciated.