Use marco to define flag variable
#define DEBUGGING using System; class Starter { #if DEBUGGING static void OutputLocals() { Console.WriteLine("debugging..."); } #endif static void Main() { #if DEBUGGING OutputLocals(); #endif } }