Click here to Skip to main content
15,881,173 members

Comments by Pankaj Chamria (Top 17 by date)

Pankaj Chamria 7-Jun-12 3:21am View    
Thanks. But am hoping for a log4net solution to this problem without having to use two logging frameworks. Of course if there is none then I may resort to the Logging Application Block in Microsoft's Enterprise Library.
Pankaj Chamria 30-Jan-12 23:35pm View    
Deleted
I think it simply should be -

#if DEBUG
PerformDebugLogging(message);

//continue with your code..

Now if you are working in Debug configuration you should have the DEBUG compilation symbol defined. And in the Release mode you wont have the DEBUG symbol defined. So automatically the PerformDebugLogging() function would not even be part of the IL generated in RELEASE mode.

I am not sure what extra you achieve using the ModeDetector() class.

Another observation - Its not just the if statement, but every time you are instantiating a new instance of the ModeDetector class within the if statement, which is completely unnecessary.
Pankaj Chamria 30-Jan-12 9:13am View    
Deleted
Reason for my vote of 2
The reason it is bad design is because it has a performance hit even in Release mode. Since you have wrapped the preprocessor directives within your own custom class, your custom lines of code will always be executed thus wasting cpu cycles on un-necessary code that should not have been executed in release mode.
I guess sometimes effort to simplify makes us tread into the wrong direction. Been there. Done that :)
Pankaj Chamria 30-Jan-12 9:08am View    
Deleted
Reason for my vote of 1
This is not an alternative. Removing a temporary variable and returning the boolean directly doesn't mean that you have come up with an alternative tip
Pankaj Chamria 30-Jan-12 8:55am View    
Deleted
Never thought about this.. Thankyou. Have 5