Chapter 24. C# preprocessor directives

If you have ever read C/C++ codes before, you can't have missed those strange looking #define and #include statements found at the beginning of the source codes. These special keywords, which begin with a # sign, are called preprocessor directives.

Preprocessor directives, though part of the source codes, are not compiled into IL codes. They are only used by the C# compiler for making certain decisions during compilation. This will become clear as you go through the examples which follow.

Table 24.1 shows the preprocessor directives supported in C#: [1]

[1] C/C++ developers: there have been significant changes to the C/C++ preprocessor directives in C#. Notice that #include is no longer a valid directive ...

Get From Java to C#: A Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.