The #define Preprocessor - CSharp Language Basics

CSharp examples for Language Basics:Preprocessor

Introduction

The #define preprocessor directive creates symbolic constants.

Demo Code

#define PI/*from w  ww.j  av  a 2s . co m*/
using System;

class Program {

      static void Main(string[] args) {
         #if (PI)
            Console.WriteLine("PI is defined");
         #else
            Console.WriteLine("PI is not defined");
         #endif
         Console.ReadKey();
      }
}

Result


Related Tutorials