#480 – Pre-Processing Directives

Pre-processing directives are elements that you can include in your source code that are not part of the source code itself.  Instead, they instruct the C# compiler to perform some particular action, like skipping compilation of a section of the code.

The pre-processing directives available in C# include:

  • #define/#undef – Define/undefine condition compilation symbols (see #if)
  • #if/#elif/#else/#endif – Skip compilation of a section of code based on the existence of a conditional compilation symbol
  • #line – specifies a line number to use when reporting errors
  • #error – issue errors during compilation
  • #warning – issue warnings during compilation
  • #region/#endregion – define a collapsible code region, to improve readability
  • #pragma warning – disable or restore certain compiler warnings
  • #pragma checksum – generate a checksum for an ASP.NET page, for debugging purposes

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: