<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://mail.logicwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Preprocessor_Directives</id>
		<title>Preprocessor Directives - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://mail.logicwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Preprocessor_Directives"/>
		<link rel="alternate" type="text/html" href="https://mail.logicwiki.co.uk/index.php?title=Preprocessor_Directives&amp;action=history"/>
		<updated>2026-07-03T03:12:50Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://mail.logicwiki.co.uk/index.php?title=Preprocessor_Directives&amp;diff=41&amp;oldid=prev</id>
		<title>Dt1nh6: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://mail.logicwiki.co.uk/index.php?title=Preprocessor_Directives&amp;diff=41&amp;oldid=prev"/>
				<updated>2016-05-09T13:27:17Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 13:27, 9 May 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;' lang='en'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Dt1nh6</name></author>	</entry>

	<entry>
		<id>https://mail.logicwiki.co.uk/index.php?title=Preprocessor_Directives&amp;diff=40&amp;oldid=prev</id>
		<title>Macrop: Created page with &quot;Category:CSharp The preprocessors directives give instruction to the compiler to preprocess the information before actual compilation starts.  All preprocessor directives...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mail.logicwiki.co.uk/index.php?title=Preprocessor_Directives&amp;diff=40&amp;oldid=prev"/>
				<updated>2014-08-19T14:08:35Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/index.php?title=Category:CSharp&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:CSharp (page does not exist)&quot;&gt;Category:CSharp&lt;/a&gt; The preprocessors directives give instruction to the compiler to preprocess the information before actual compilation starts.  All preprocessor directives...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:CSharp]]&lt;br /&gt;
The preprocessors directives give instruction to the compiler to preprocess the information before actual compilation starts.&lt;br /&gt;
&lt;br /&gt;
All preprocessor directives begin with #, and only white-space characters may appear before a preprocessor directive on a line. Preprocessor directives are not statements, so they do not end with a semicolon (;).&lt;br /&gt;
&lt;br /&gt;
C# compiler does not have a separate preprocessor; however, the directives are processed as if there was one. In C# the preprocessor directives are used to help in conditional compilation. Unlike C and C++ directives, they are not used to create macros. A preprocessor directive must be the only instruction on a line.&lt;br /&gt;
&lt;br /&gt;
== List of Preprocessor Directives in C# ==&lt;br /&gt;
The following table lists the preprocessor directives available in C#:&lt;br /&gt;
&lt;br /&gt;
Preprocessor Directive	Description.&lt;br /&gt;
&lt;br /&gt;
* #define	It defines a sequence of characters, called symbol.&lt;br /&gt;
* #undef	It allows you to undefine a symbol.&lt;br /&gt;
* #if	It allows testing a symbol or symbols to see if they evaluate to true.&lt;br /&gt;
* #else	It allows to create a compound conditional directive, along with #if.&lt;br /&gt;
* #elif	It allows creating a compound conditional directive.&lt;br /&gt;
* #endif	Specifies the end of a conditional directive.&lt;br /&gt;
* #line	It lets you modify the compiler's line number and (optionally) the file name output for errors and warnings.&lt;br /&gt;
* #error	It allows generating an error from a specific location in your code.&lt;br /&gt;
* #warning	It allows generating a level one warning from a specific location in your code.&lt;br /&gt;
* #region	It lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor.&lt;br /&gt;
* #endregion	It marks the end of a #region block.&lt;br /&gt;
&lt;br /&gt;
=== The #define Preprocessor ===&lt;br /&gt;
The #define preprocessor directive creates symbolic constants.&lt;br /&gt;
&lt;br /&gt;
#define lets you define a symbol, such that, by using the symbol as the expression passed to the #if directive, the expression will evaluate to true. Its syntax is as follows:&lt;br /&gt;
&lt;br /&gt;
 #define symbol&lt;br /&gt;
&lt;br /&gt;
The following program illustrates this:&lt;br /&gt;
&lt;br /&gt;
 #define PI &lt;br /&gt;
 using System;&lt;br /&gt;
 namespace PreprocessorDAppl&lt;br /&gt;
 {&lt;br /&gt;
    class Program&lt;br /&gt;
    {&lt;br /&gt;
       static void Main(string[] args)&lt;br /&gt;
       {&lt;br /&gt;
          #if (PI)&lt;br /&gt;
             Console.WriteLine(&amp;quot;PI is defined&amp;quot;);&lt;br /&gt;
          #else&lt;br /&gt;
             Console.WriteLine(&amp;quot;PI is not defined&amp;quot;);&lt;br /&gt;
          #endif&lt;br /&gt;
          Console.ReadKey();&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
When the above code is compiled and executed, it produces the following result:&lt;br /&gt;
&lt;br /&gt;
PI is defined&lt;br /&gt;
=== Conditional Directives ===&lt;br /&gt;
You can use the #if directive to create a conditional directive. Conditional directives are useful for testing a symbol or symbols to see if they evaluate to true. If they do evaluate to true, the compiler evaluates all the code between the #if and the next directive.&lt;br /&gt;
&lt;br /&gt;
Syntax for conditional directive is:&lt;br /&gt;
&lt;br /&gt;
 #if symbol [operator symbol]...&lt;br /&gt;
&lt;br /&gt;
Where, symbol is the name of the symbol you want to test. You can also use true and false or prepend the symbol with the negation operator.&lt;br /&gt;
&lt;br /&gt;
The operator symbol is the operator used for evaluating the symbol. Operators could be either of the following:&lt;br /&gt;
&lt;br /&gt;
== (equality)&lt;br /&gt;
&lt;br /&gt;
!= (inequality)&lt;br /&gt;
&lt;br /&gt;
&amp;amp;&amp;amp; (and)&lt;br /&gt;
&lt;br /&gt;
|| (or)&lt;br /&gt;
&lt;br /&gt;
You can also group symbols and operators with parentheses. Conditional directives are used for compiling code for a debug build or when compiling for a specific configuration. A conditional directive beginning with a #if directive must explicitly be terminated with a #endif directive.&lt;br /&gt;
&lt;br /&gt;
The following program demonstrates use of conditional directives:&lt;br /&gt;
&lt;br /&gt;
 #define DEBUG&lt;br /&gt;
 #define VC_V10&lt;br /&gt;
 using System;&lt;br /&gt;
 public class TestClass&lt;br /&gt;
 {&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {  &lt;br /&gt;
 &lt;br /&gt;
       #if (DEBUG &amp;amp;&amp;amp; !VC_V10)&lt;br /&gt;
          Console.WriteLine(&amp;quot;DEBUG is defined&amp;quot;);&lt;br /&gt;
       #elif (!DEBUG &amp;amp;&amp;amp; VC_V10)&lt;br /&gt;
          Console.WriteLine(&amp;quot;VC_V10 is defined&amp;quot;);&lt;br /&gt;
       #elif (DEBUG &amp;amp;&amp;amp; VC_V10)&lt;br /&gt;
          Console.WriteLine(&amp;quot;DEBUG and VC_V10 are defined&amp;quot;);&lt;br /&gt;
       #else&lt;br /&gt;
          Console.WriteLine(&amp;quot;DEBUG and VC_V10 are not defined&amp;quot;);&lt;br /&gt;
       #endif&lt;br /&gt;
       Console.ReadKey();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
When the above code is compiled and executed, it produces the following result:&lt;br /&gt;
&lt;br /&gt;
 DEBUG and VC_V10 are defined&lt;/div&gt;</summary>
		<author><name>Macrop</name></author>	</entry>

	</feed>