Debug Class |
System.Diagnostics
No
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.
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.
Debug.Assert Method, Debug.Write Method, Debug.WriteLine Method