Is there any mechanism where you Debug.WriteLine(someinfo) while you are debugging a project and mark off some checkbox where this debug.writeline(someinfo) doesn’t get called if I don’t want to. I want to see the debug info on small data, but on big data I can just turn it off without me commenting out all the debug.writelines. Is there such thing is #DEBUG/preprocessor flags that I can use in Visual Studio? I’m still in the “Debug” context when I want to see and not see the debug.writelines depending on some kind of flag?
Is there any mechanism where you Debug.WriteLine(someinfo) while you are debugging a project and
Share
You could create a new Build Configuration (base on Debug, and named
DEBUG_NO_TRACE, for example).Menu
Build => ConfigurationManager
In Active Solution Configuration, Select new , Copy settings from Debug
Then create a new preprocessor flag
#DEBUG_NO_TRACEin you project properties (Build tab).And put
#IF DEBUG_NO_TRACEwhere you want a difference.And chosse that build configuration when you want to.
But there’s maybe a more elegant solution…