O'Reilly logo

C# for Java Developers by Adam Freeman, Allen Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Preprocessor Directives

Preprocessor directives are instructions to the C# compiler to perform some action during compilation. There is no equivalent functionality in Java. The term preprocessor directive is misleading because the compilation process does not include a preprocessing step, but the term is a legacy of C/C++ and has remained to avoid confusion.

Preprocessor directives are used to

  • Conditionally include and exclude sections of code during compilation.

  • Force the compiler to issue warnings and errors.

  • Group related sections of source code.

  • Alter the line number and file-name references displayed by the compiler for errors and warnings.

Preprocessor directives are preceded by the # symbol and must be the only command on a line. They are not ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required