Home All Groups Group Topic Archive Search About

Techniques in VB for Debugging vs Production Code

Author
13 Mar 2006 11:19 PM
Sebastian
Hi,
I'm coming from a C/C++ background and wondering if there's a
straightforward way to designate debugging code in a vb.net application?
  I'm accustomed to setting up a Preprocessor macro "Debug()" in the
tradition of Steve McConnell, which will include or exclude chunks of
code depending on a debugging flag, or debugging level.  So far the only
option I see open to me is if/then blocks.  Anyone have any tips?

Author
13 Mar 2006 11:36 PM
Chris
Sebastian wrote:
> Hi,
> I'm coming from a C/C++ background and wondering if there's a
> straightforward way to designate debugging code in a vb.net application?
>  I'm accustomed to setting up a Preprocessor macro "Debug()" in the
> tradition of Steve McConnell, which will include or exclude chunks of
> code depending on a debugging flag, or debugging level.  So far the only
> option I see open to me is if/then blocks.  Anyone have any tips?

You can do
#if Debug then

#else

#end if

to add code during debug session.
if you wanted to add an entire function then do:

#if Debug then DebugCode()