June 2003
Intermediate to advanced
624 pages
12h 41m
English
The last topic discussed in this chapter is using preprocessor directives. These are directives to the compiler, not C# statements, and they enable you to skip compilation of sections of your code that you specify.
Here are the C# preprocessing directives:
#define and #undef are used to define and undefine, respectively, conditional compilation symbols.
#if, #elif, #else, and #endif are used to conditionally skip sections of source code.
#error and #warning are used to display errors and warnings, respectively.
#region and #endregion are used to mark sections of source code.
#line is used to control line numbers for errors and warnings.
You can see an example in ch01_12.cs, Listing 1.12. In that example, it's the user's birthday, ...