C# Preprocessor Directives


Jump to: navigation, search
Visual C# Tutorials
Visual C# .NET Tutorials
C# Preprocessor Directives

Contents


What? No C# Macros?

The first thing I will point out—specially for those of you scouring the Web for using macros in C#—is that creating macros in C# is not possible. Unfortunately, the creators of C# decided that code would be much more readable without them; so, no macros.


C# Commands

In C# there are 3 main groups of Pre-Processor commands available:

The following table shows all available 11 Pre-Processor commands:

Conditional Comilation(al) Visual
#define #warning #region
#undef #error #endregion
#if #line
#else
#elif
#endif

Share this page
  • del.icio.us
  • Facebook
  • Google+
  • StumbleUpon