Preprocessor Directives

You can view the C# compiler as containing a separate preprocessor that processes and prepares the source code for the compiler before the actual compilation takes place. Programmers can use preprocessor directives to mark parts of the source code and thereby instruct the preprocessor to treat these parts in a certain way.

Note

Several of C#'s predecessors, including the C language, contain preprocessors that are separate from the compiler. This is not the case for C# where the preprocessor directives are processed as part of the lexical analysis (this explains the highlighted word view in the first line of this section). ...

Get C# Primer Plus 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.