Use marco to define flag variable Posted on February 11, 2011June 27, 2015 by coder #define DEBUGGING using System; class Starter { #if DEBUGGING static void OutputLocals() { Console.WriteLine("debugging..."); } #endif static void Main() { #if DEBUGGING OutputLocals(); #endif } }