Debug Class

   
Debug Class

Namespace

System.Diagnostics

Createable

No

Description

The Debug object is used to send messages to the Output window (formerly called the Immediate window). The Debug object can also send output to other targets, such as text files, referred to as listeners . See the Debug.Listeners Property entry. The Debug class also allows you to check program logic with assertions.

Because the Debug class' members are shared, you do not need to instantiate the Debug object before accessing its members. The following code fragment, for instance, illustrates a call to the Debug object's WriteLine method:

 Debug.WriteLine(intCount & " iteration through the loop") 

Debug class members marked with an plus sign (+) are discussed in detail in their own entries.

Public Shared Properties

AutoFlush +
IndentLevel +
IndentSize +
Listeners +

Public Shared Methods

Assert +
Close +
Fail
Flush +
Indent +
Unindent +
Write +
WriteIf +
WriteLine +
WriteLineIf +

VB.NET/VB 6 Differences

The VB 6 Debug object has only two methods, Assert and Print. The VB.NET Assert method is similar to the VB 6 method, except that the latter displays a message if an expression is False , while the former suspends program execution. In VB.NET, the VB 6 Print method is gone, replaced by the Write, WriteIf, WriteLine, and WriteLineIf methods.

See Also

Debug.Assert Method, Debug.Write Method, Debug.WriteLine Method

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net