Alex Rivera | Logout

Will #if RELEASE work like #if DEBUG does in C#?

Asked 2009-02-03T15:58:26.557
310

In all the examples I've seen of the #if compiler directive, they use "DEBUG". Can I use "RELEASE" in the same way to exclude code that I don't want to run when compiled in debug mode? The code I want to surround with this block sends out a bunch of emails, and I don't want to accidentally send those out when testing.

Edit
Report

1 Answer

439

RELEASE is not defined, but you can use

#if (!DEBUG)
  ...
#endif
answered 2009-02-03T16:01:19.093

Your Answer