C# Supported Preprocessing Directives

The following directives are supported during preprocessing:

Directive

Description

#define

Defines a symbol

#undefine

Removes a previous definition of the symbol

#if

Evaluates a condition, if the condition is true, the statement following the condition is kept otherwise it is ignored

#elif

Used with the #if directive, if the previous #if test fails, #elif includes or exclude source code, depending on the resulting value of its own expression or identifier

#endif

Closes the #if conditional block of code

#warning

Displays a warning message if the condition is true

#error

Displays an error message if the condition is true

Note: #region, #endregion, and #line directives are removed from source code.