Skip to content

Instantly share code, notes, and snippets.

@jknopp
Last active February 5, 2021 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jknopp/b369795a52f8a07136fb34c250c32b1a to your computer and use it in GitHub Desktop.
Save jknopp/b369795a52f8a07136fb34c250c32b1a to your computer and use it in GitHub Desktop.
Determine if running in DEBUG mode
public interface ISystemService
{
bool IsRunningInDebugMode();
}
public class SystemService : ISystemService
{
private bool _debugging;
public bool IsRunningInDebugMode()
{
//#if DEBUG
//return true;
//#else
//return false;
//#endif
ConditionalCheck();
return _debugging;
}
[Conditional("DEBUG")]
private void ConditionalCheck()
{
_debugging = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment