C# Preprocessor Directives

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Tutorials
C# Tutorials
C# Preprocessor Directives
edit

Contents


What? No 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.

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
#elif
#endif


MSDN references


Personal tools