CHAPTER 25

image

Preprocessor

C# includes a set of preprocessor directives that are mainly used for conditional compilation. Although the C# compiler does not have a separate preprocessor, as C and C++ compilers, the directives shown below are processed as if there was one. That is, they appear to be processed before the actual compilation takes place.

 

Directive Description
#if #elif #else #endif If Else if Else End if
#define #undef Symbol define Symbol undefine
#error #warning #line Generate error Generate warning Set line number
#region #endregion Mark section start Mark section end

Preprocessor directive syntax

The preprocessor ...

Get C# Quick Syntax Reference 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.