Write different code for Debug and Release Mode

Many time a developer needs to write a code in which he wants something different in Debug Mode and Something different in Release Mode

Most probably this is used at the time of initializing objects or displaying errors.

1. In debug mode I want to Initialize an array with some random numbers and In release mode I want to get array values from user.  It is not possible to change code every time you give in release or test in debug.
2. Same in Exception handling We want to show detailed error message in debug  mode but minimum error message after release. (For Security Reasons.).

In C# there #if DEBUG is a solution for the above problem.


Search This Blog

Link Within Related Posts Plugin for WordPress, Blogger...