O'Reilly logo

Application Development Using Visual Basic® and .NET by Dana L. Wyatt, Peter Thorsteinson, Robert J. Oberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the Debug and Trace Classes

The useful methods and properties are shared. The overloaded WriteLine and Write are used to write debug or trace output. The overloaded WriteLineIf and WriteIf write output if the condition in their first argument is true.

Debug.WriteLine( _
   "This was compiled with a DEBUG directive!")
Trace.WriteLine( _
   "This was compiled with a TRACE directive!")
...
Debug.WriteLineIf(DebugBooleanSwitch.Enabled, _
   "Debug Boolean Switch enabled at startup.")
Debug.WriteLineIf(Not DebugBooleanSwitch.Enabled, _
   "Debug Boolean Switch disabled at startup.")

Output is indented with the Indent and Unindent methods. The indentation size is controlled with the IndentSize property.

Trace.Indent()
...
Trace.IndentSize = 10

You can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required