Skip to Content
Microsoft® Visual C#® .NET 2003 Kick Start
book

Microsoft® Visual C#® .NET 2003 Kick Start

by Steven Holzner
June 2003
Intermediate to advanced
624 pages
12h 41m
English
Sams
Content preview from Microsoft® Visual C#® .NET 2003 Kick Start

Preprocessor Directives

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, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® .NET Kick Start

Microsoft® .NET Kick Start

Hitesh Seth

Publisher Resources

ISBN: 0672325470Purchase book