#if (DEBUG)

//DEBUG必须大写,其它是不认的
#if (DEBUG)
            Console.WriteLine("Debug");
#else
            Console.WriteLine("非Debug");
#endif
原文地址:https://www.cnblogs.com/pnljs/p/3261416.html