Preprocessor Directives in C# - CSharp Language Basics

CSharp examples for Language Basics:Preprocessor

Introduction

Preprocessor Directives Usage
#definedefines a sequence of characters, called symbol.
#undef undefine a symbol.
#if testing a symbol or symbols to see if they evaluate to true.
#else create a compound conditional directive, along with #if.
#elif creating a compound conditional directive.
#endif Specifies the end of a conditional directive.
#line modify the compiler's line number and the file name output for errors and warnings.
#errorgenerating an error from a specific location in your code.
#warninggenerating a level one warning from a specific location in your code.
#region mark a block of code for Visual Studio Code Editor.
#endregion marks the end of a #region block.

Related Tutorials