When #if DEBUG runs

后端 未结 7 596
星月不相逢
星月不相逢 2020-12-14 06:03

I have this code in my C# class.

#if DEBUG
        private const string BASE_URL = \"http://www.a.com/\";
#else
        private const string BASE_URL = \"h         


        
7条回答
  •  失恋的感觉
    2020-12-14 06:48

    That is a "compiler directive", which means it will actually include or exclude the code from the build process (or compiling) based on the #if's that you put in. That being said, the DEBUG symbol is in the properties of your project, and in Visual Studio is generally removed automatically on the "Release" build.

    So basically, it doesn't have to be in Visual studio running in debug, and it does not have to be in any certain folder, your code is just built that way.

提交回复
热议问题