Tuesday, January 07, 2003
Is the debugger running?
Sean 'Early' Campbell & Scott 'Adopter' Swigart wonder:
I was wondered if there's a way to have your code programmatically determine if it's running in debug or release mode.
This reminded me of a trick that I saw recently.
using System.Diagnostics; namespace IsDebuggerPresent { class WaitWhenDebugging { [STAThread] static void Main(string[] args) { Console.WriteLine("Hello World"); if(System.Diagnostics.Debugger.IsAttached) { Console.WriteLine("Press enter to continue..."); Console.Read(); } } } } |
| csharpindex.com/colorCode |
It doesn't do what Sean & Scott need but it is still handy.
10:33:26 PM
