Thursday, July 23, 2015

Enable and disable codes between #if #endif

When we want to comment out some code in specific condition, we can use #if  and #endif in C#  instead of comment and uncomment things.

#if Local
   do something1
#endif
 
#if Test
    do something2
#endif

If you want to enable do something1 and do something2:
Under Project -> your project property
Build tab -> Conditional compilation symbols: Local; Test

Enable the modes separated by semicolon.

No comments:

Post a Comment