In this article i am going to explain how to programatically check Debug or Release mode in C#.
By default, Visual Studio defines DEBUG if project is compiled in Debug mode and doesn't define it if it's in Release mode. So, if you want to add different code for Debug and Release modes, use the following code
If you only want to check for release mode, then use the following code
In this way, we can check for Debug and Release modes programatically in c#.
By default, Visual Studio defines DEBUG if project is compiled in Debug mode and doesn't define it if it's in Release mode. So, if you want to add different code for Debug and Release modes, use the following code
#if DEBUG
// add debug mode code goes here
#else
// add release mode code goes here
#endif
If you only want to check for release mode, then use the following code
#if !DEBUG
// add debug mode code here...
#endif
In this way, we can check for Debug and Release modes programatically in c#.
For more posts on c# visit C-Sharp
No comments:
Post a Comment