>>
>>You can also test for debug mode
>>>>>>>>if (System.Diagnostics.Debugger.IsAttached)
>>>>{
>>>> DoSomething()
>>>>}
>>>>else
>>>>{
>>>> DoSomethingElse()
>>>>}
>>>>
>>>
>>>I didn't know that. But now that I do I'm having trouble seeing a use for it.....>>
>>
>>I use that occasionally for error messages. IOW, an error message that gets displayed to the user at runtime might be an abbreviated version of the error message displayed to the developer during debugging.
>
>OK. But conditional compilation can do that. Using this it feels that I would be compiling/shipping surplus production code. i.e. if you're going to be around to debug it then why not just run a debug version.......
I would also use conditional compilation over the if statement, I go as far as doing this for the design mode test:
#if DEBUG
if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
#endif
{
}