Preprocessing Directives : Define : Preprocessing Directives C# Examples


C# Examples » Preprocessing Directives » Define »

 

Preprocessing Directives






The #define directive defines a character sequence called a symbol.
The existence or nonexistence of a symbol can be determined by #if or #elif

The general form for #define:




    
#define  symbol
    
   
  
   





    
#define  DEBUGLOG

using  System;

class  MainClass
{
        public  static  void  Main()
        {
                #if  DEBUGLOG
                Console.WriteLine("In  Main  -  Debug  Enabled");
                #else
                Console.WriteLine("In  Main  -  No  Debug");
                #endif
        }
}
    
   
  
   



Output

In Main - Debug Enabled


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Preprocessing Directives
» Define