Conditional Breakpoint
You know how to put conditional breakpoint or do u know
what conditional breakpoints are .. no? anyhow conditional breakpoints are such breakpoints which stop
debugging execution conditionally i.e, either condition “is true” or
“has changed” if criteria met then breakpoint will get active if no
then execution wont stop on breakpoint ..isn’t that coooooool …. look
on following code and then steps to put breakpoint on it
static void Main(string[] args)
{
int result = add(11, 3);
Console.Write(result);
Console.Read();
}
public static int add(int a, int b)
{
int c;
c = a + b;
return c;
}
steps:
- press control+alt+A+B to get/activate breakpoint window
- In the Breakpoints window, click New to create a new breakpoint.
- On the Function tab, type add for Function. Type 1 for Line, type 1 for Character, and then set Language to C# then press OK
- now right click on that breakpoint and select condition, and make sure that the Condition check box is selected. Type a > 0 for Condition, make sure that the is true option is selected, and then click OK.
- In the New Breakpoint dialog box, click OK.
- On the Debug menu, click Start.
- The program stops at the IF statement in the Main method. To continue program execution, click Continue on the Debug menu.
- The program stops again at the addfunction. Continue to run the program.