调试时才执行的代码

只有在调试时才执行的DEBUG那部分的代码,否则执行else那部分的代码,最后用endif结束语句;

代码如下:

            string end = "";
#if DEBUG
         {   end = "Debug";
                Console.WriteLine(end);
          }

#else
            {
                end = "no Debug";
                Console.WriteLine(end);
            }

#endif

  

原文地址:https://www.cnblogs.com/SHa-Jazy/p/15391298.html