System.Diagnostics.Debugger

10.11.07

Problem: You need functionality turned off or on when you are running your program in Debug mode.

Solution: System.Diagnostics.Debugger.IsAttached; it is a static property that returns true if there is a Debugger attached. I like to use this when debugging websevices, timing out while fixing a problem can be annoying.

if (Debugger.IsAttached)
     _webService.Timeout = -1;

More info:

MSDN