Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From <strong><a href="http://msdn.microsoft.com/en-us/library/ey1471zb%28v=vs.90%29.aspx" rel="nofollow">Compiler Error CS1517</a></strong></p> <p>The following sample shows some valid and invalid preprocessor expressions:</p> <pre><code>#if symbol // OK #endif #if !symbol // OK #endif #if (symbol) // OK #endif #if true // OK #endif #if false // OK #endif #if 1 // CS1517 #endif #if ~symbol // CS1517 #endif #if * // CS1517 #endif class x { public static void Main() { } } </code></pre> <p>So I think you can use like this;</p> <pre><code>#define _MyType #If _MyType </code></pre> <p>From <strong><a href="http://msdn.microsoft.com/en-us/library/4y6tbswk%28v=vs.90%29.aspx" rel="nofollow">#if</a></strong> </p> <blockquote> <p>When the C# compiler encounters an #if directive, followed eventually by an #endif directive, it will compile the code between the directives <strong>only if the specified symbol is defined</strong>. Unlike C and C++, you cannot assign a numeric value to a symbol; the #if statement in C# is Boolean and only tests whether the symbol has been defined or not.</p> </blockquote> <pre><code>#define DEBUG // ... #if DEBUG Console.WriteLine("Debug version"); #endif </code></pre> <blockquote> <p><strong>You can use the operators == (equality), != (inequality) only to test for true or false . True means the symbol is defined</strong>. The statement -#if DEBUG has the same meaning as #if (DEBUG == true). The operators &amp;&amp; (and), and || > (or) can be used to evaluate whether multiple symbols have been defined. You can also group symbols and operators with parentheses.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload