I have some code that access an API out on the web. One of the API\'s parameters allows me to let them know that I am testing.
I would like to only set this parameter in
yes, wrap the code in
#if DEBUG
// do debug only stuff
#else
// do non DEBUG stuff
#endif
Google for "C# compilation symbols"
Visual Studio automatically defines DEBUG when you are in the debug configuration. You can define any symbols you want (look at your project's properties, the build tab). Beware that abusing preprocessor directives is a bad idea, it can lead to code that is very difficult to read/maintain.