Language Basics C# Book

Preprosessor directives mark the code block for compiler.
For example,
#define DEBUG
using System;
class MyClass
{
int x;
void aMethod()
{
# if DEBUG
Console.WriteLine("Testing: x = {0}", x);
# endif
}
}
If DEBUG is defined C# will compile the statement.
We can supply the flag with /define:Symbol through commandline.
The following table lists all C# Preprosessor directives
Preprocessor directive Action
#define symbol Defines symbol
#undef symbol Undefines symbol
#if symbol [operator symbol2]... operators are ==, !=, &&, and || followed by #else, #elif, and #endif
#else Executes code to subsequent #endif
#elif symbol [operator symbol2] Combines #else branch and #if test
#endif Ends conditional directives
#warning text warning text for compiler output
#error text error text for compiler output
#line [ number ["file"] | hidden] number specifies the line in source code; file is the filename to appear in computer output; hidden instructs debuggers to skip over code from this point until the next #line directive
#region name beginning of an outline
#end region Ends an outline