How do you put an "IF DEBUG" condition in a c# program?
        Posted  
        
            by xarzu
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by xarzu
        
        
        
        Published on 2010-06-16T19:28:09Z
        Indexed on 
            2010/06/16
            19:32 UTC
        
        
        Read the original article
        Hit count: 213
        
How do you put an "IF DEBUG" condition in a c# program so that, at run time, it will ignore a set of code if you are running in Debug mode and yet, execute a block of code if the program is not running in debug mode? A situation where this can be used is if a time stamp is taken at the start of a block and another time stamp is taken at the end. THey will hardly differ at run time. Yet, if you are stepping through the code in debug mode, they will differ a lot, and error conditions in an "if block" might be kicked off leading to the untimely (pun) execution of some code.
© Stack Overflow or respective owner