Use #if to check flag defined by #define and #undef - CSharp Language Basics

CSharp examples for Language Basics:Preprocessor

Description

Use #if to check flag defined by #define and #undef

Demo Code

#undef STANDARDVERSION/*from  w w w  .  jav a2  s  .  com*/
#define PROFESSIONALVERSION
#undef ENTERPRISEVERSION
using System;
class BliposExplorer
{
   public static void Main()
   {
      #if STANDARDVERSION
         Console.WriteLine("This is the standard version");
      #endif
      #if PROFESSIONALVERSION
         Console.WriteLine("This is the professional version");
      #endif
      #if ENTERPRISEVERSION
         Console.WriteLine("This is the enterprise version");
      #endif
   }
}

Result


Related Tutorials