Debug Breakpoints

The following code can be placed in an appropriate place in your source code. The test "(i1 == 40)" can be anything you need it to be and when the condition is met the IDE will execute the breakpoint.

If you are using Visual Studio C# Express then this is your only option for breakpoints since the ability to set breakpoints through the IDE has been removed.

Even if you don't have the Express version of Visual Studio you may still find this code helpful as setting conditional breakpoints in the IDE tend to slow things down quite a bit. Placing the breakpoint directly in the code accomplishes condition checking without the slowdown.


#if DEBUG
if (i1 == 40)
{
  System.Diagnostics.Debugger.Break();
}
#endif