C#预处理指令

#define

#undef

#if

#else

#elif(else if 的简写)

#endif

定义和不定义(#define、#undef)必须加在最开头

#define abc (要在所有非预处理指令的前面,包括命名空间)

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApplication1

{    

  class Program    

  {                

    static void Main(string[] args)        

    {

#if abc            

      Console.WriteLine("abc");   

#endif            

      Console.ReadLine();

          }    

  }

}

输出abc

posted on 2015-03-23 13:19  wos1239  阅读(112)  评论(0编辑  收藏  举报

导航