Will it? I mean, the optimiser in the compiler in release mode will say that
the procedure call is empty, and has no effect, therefore the call is
altogether elliminated...
"Ed Courtenay" <my***********@edcourtenay.co.uk> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
That's not exactly true; the Debug.Write statement will be compiled and
called in both Debug and Release builds. The difference is that in Release
builds the function won't actually do anything as TraceInternal class won't
have any listeners registered.
This means you will still have a (slight) overhead in Release builds
whenever Debug.Write is called.
"Eric Newton" <er**@cc.ensoft-software.com> wrote in message
news:ud*************@tk2msftngp13.phx.gbl...
Also, if you use the Debug statements "Debug.WriteLine", "Debug.*", the c#
and vb.net compilers automatically ignore these statements in release
builds.
--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
er**@cc.ensoft-software.com [remove the first "CC."]
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... <"Daniel Bass" <I'm really @ sick of spam>> wrote: In C++ you can use the following:
#ifndef _DEBUG
// code here only runs in debug mode
#endif
I think you meant:
#ifdef _DEBUG
there.
You can do that with C# too:
#if DEBUG
...
#endif
where you can set different code to be included in different builds. Useful for having a logging system for debugging only when compiling the project in Debug, but wanting to turn it off in Release.
For that kind of thing it's actually easier to use an attribute on the
method you're calling - look at the Trace class for an example.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too