#if preprocessor directive for directives other than DEBUG

前端 未结 4 2110
暖寄归人
暖寄归人 2020-12-30 19:13

I know that I can use preprocessor directives to check for Debug/Release by doing this:

#if DEBUG
    //debug mode
#elif
    //release mode
#endif

4条回答
  •  佛祖请我去吃肉
    2020-12-30 19:57

    Right click on the Project [Project name] name you want to use the custom precompiler directive.

    Go to the properties item and then to the build tab.

    then you need to add your custom directive there in the textbox. E.g i have added 'Local' as my custom directive see image below

    enter image description here

    Now you can can use the new compiler directive as shown below in your (in C#)

      #if **Local**
        //TODO:Add your c# code here
      #endif
    

提交回复
热议问题