#undef Marco : Preprocessor Directives : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Preprocessor Directives »

 

#undef Marco








    
 


#define MYOWN
#define DEBUG
#undef VERBOSE
#define PROGRAMMER_IS_BRIAN
#undef PROGRAMMER_IS_DAVE

using System;

class Preprocessor {
    static void Main() {
#if MYOWN
        Console.WriteLine("Hi Author!");
#elif VERBOSE
   Console.WriteLine("Program Starting?);
#endif
        int a = 10, b = 5;
#if DEBUG
        Console.WriteLine("a={0}, b={1}", a, b);
#endif

#if MYOWN && (VERBOSE || DEBUG)
        Console.WriteLine("Continuing, Author");
#elif !MYOWN && (VERBOSE || DEBUG)
   Console.WriteLine("Continuing?);
#endif

#if PROGRAMMER_IS_BRIAN || PROGRAMMER_IS_DAVE
#warning Execution may vary depending on programmer.
#endif

#if PROGRAMMER_IS_DAVE
#error Something you did broke this code.
#endif
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Preprocessor Directives