How to find whether it is in debug mode or release mode? Are there any other ways to find it?
#if(DEBUG)
{
Console.WriteLine("Debug mode");
//Or Things to do in debug mode
}
#else
{
Console.WriteLine("Release mode");
//Or Things to do in Release mode- May be to change the text, image
}
#endif
No that's the only way, but you need to have the syntax and capitalization correct. You can also check whether the debugger is attached. Here is the correct syntax:
#if DEBUG
Console.Writeline("debug");
#else
Console.Writeline("release");
#endif
// You can also check if a debugger is attached, which can happen in either debug or release
if (Debugger.IsAttached)
Console.WriteLine("debugger attached");
You could try using System.Diagnostics:
if (Debugger.IsAttached) {...
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With