Macro in action : Macro « Development Class « C# / C Sharp






Macro in action

using System;

class Class1{

  static void Main(string[] args)  {
    #if false
      Console.WriteLine("A");
    #elif false
      Console.WriteLine("B");
    #else
            Console.WriteLine("C");
      #endif
  }
}



           
       








Related examples in the same category

1.The use of the #define, #if, and #endif preprocessor directivesThe use of the #define, #if, and #endif preprocessor directives
2.#undef, #elif, and #else preprocessor directives#undef, #elif, and #else preprocessor directives
3.Define macro for conditional compile