Show/Hide Toolbars

XSharp

Purpose

When the X# compiler encounters an #ifdef directive, followed eventually by an #endif directive, it will compile the code between the directives only if the specified symbol is defined.

The #ifdef statement in X# is Boolean and only tests whether the symbol has been defined or not. For example,

 

// DEBUG may be defined from the command line
// ...
#if DEBUG
   Console.WriteLine("Debug version");
#else
   Console.WriteLine("Release version");
#endif

Note

The /vo8 compiler option will change this behavior:

when /vo8 is active then any symbol defined with TRUE or a non-0 numeric value will be seen as "defined", symbols defined with FALSE or a 0 numeric value will be seen as "undefined".

 

See also