Techniques in VB for Debugging vs Production Code

S

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?
 
C

Chris

Sebastian said:
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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top