lapucca
asked on
Question about "#if DEBUG"
Hi, I'm using VS2013, C# and asp.net web form
I want to print out messages from application to be different when it's in Debug mode and when it's in Release mode. I'm confused about how to use the #if DEBUG statement. Do I need to have "#define DEBUG " statement at the top of the main page aspx? Reading this link just confuses me, https://msdn.microsoft.com/en-us/library/4y6tbswk.aspx and http://stackoverflow.com/questions/1734741/how-to-execute-code-only-in-debug-mode-in-asp-net
I want the program to auto detect if it's in DEBUG mode but if I use the define statement does that always put it in DEBUG mode?
Thank you.
Does syntax like this is correct?
#if DEBUG
output this message;
#else
output this other message;
I want to print out messages from application to be different when it's in Debug mode and when it's in Release mode. I'm confused about how to use the #if DEBUG statement. Do I need to have "#define DEBUG " statement at the top of the main page aspx? Reading this link just confuses me, https://msdn.microsoft.com/en-us/library/4y6tbswk.aspx and http://stackoverflow.com/questions/1734741/how-to-execute-code-only-in-debug-mode-in-asp-net
I want the program to auto detect if it's in DEBUG mode but if I use the define statement does that always put it in DEBUG mode?
Thank you.
Does syntax like this is correct?
#if DEBUG
output this message;
#else
output this other message;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To your question :
Does syntax like this is correct?
#if DEBUG
output this message;
#else
output this other message;
If before this code you have #define DEBUG then "output this message;" will be executed if it is not appear before the statement then " output this other message;" this will be executed.
Does syntax like this is correct?
#if DEBUG
output this message;
#else
output this other message;
If before this code you have #define DEBUG then "output this message;" will be executed if it is not appear before the statement then " output this other message;" this will be executed.
ASKER