In The Hand - .NET Components for Mobility
TraceHelper Class
NamespacesInTheHand.DiagnosticsTraceHelper
Extends the Trace class.
Declaration Syntax
C#Visual Basic
public static class TraceHelper
Public NotInheritable Class TraceHelper
Members
All MembersMethodsProperties



IconMemberDescription
AutoFlush
Gets or sets whether Flush()()() should be called on the Listeners after every write.

Close()()()
Flushes the output buffer, and then closes the Listeners.

Fail(String)
Emits an error message.

Fail(String, String)
Emits an error message, and a detailed error message.

Flush()()()
Flushes the output buffer, and causes buffered data to be written to the Listeners.

Indent()()()
Increases the current IndentLevel by one.

IndentLevel
Gets or sets the indent level.

IndentSize
Gets or sets the number of spaces in an indent.

Listeners
Gets the collection of listeners that are monitoring the trace output.

Unindent()()()
Decreases the current IndentLevel by one.

Write(Object)
Writes the value of the object's ToString method to the trace listeners in the Listeners collection.

Write(Object, String)
Writes a category name and the value of the object's ToString method to the trace listeners in the Listeners collection.

Write(String)
Writes a message to the trace listeners in the Listeners collection.

Write(String, String)
Writes a category name and a message to the trace listeners in the Listeners collection.

WriteIf(Boolean, Object)
Writes the value of the object's ToString method to the trace listeners in the Listeners collection if a condition is true.

WriteIf(Boolean, Object, String)
Writes a category name and the value of the object's ToString method to the trace listeners in the Listeners collection if a condition is true.

WriteIf(Boolean, String)
Writes a message to the trace listeners in the Listeners collection if a condition is true.

WriteIf(Boolean, String, String)
Writes a category name and message to the trace listeners in the Listeners collection if a condition is true.

WriteLine(Object)
Writes the value of the object's ToString method to the trace listeners in the Listeners collection.

WriteLine(Object, String)
Writes a category name and the value of the object's ToString method to the trace listeners in the Listeners collection.

WriteLine(String)
Writes a message to the trace listeners in the Listeners collection.

WriteLine(String, String)
Writes a category name and message to the trace listeners in the Listeners collection.

WriteLineIf(Boolean, Object)
Writes the value of the object's ToString method to the trace listeners in the Listeners collection if a condition is true.

WriteLineIf(Boolean, Object, String)
Writes a category name and the value of the object's ToString method to the trace listeners in the Listeners collection if a condition is true.

WriteLineIf(Boolean, String)
Writes a message to the trace listeners in the Listeners collection if a condition is true.

WriteLineIf(Boolean, String, String)
Writes a category name and message to the trace listeners in the Listeners collection if a condition is true.

Remarks
You can use the properties and methods in the TraceHelper class to instrument release builds. Instrumentation allows you to monitor the health of your application running in real-life settings. Tracing helps you isolate problems and fix them without disturbing a running system.

This class provides methods to emit an assertion that will always Fail(String). This class provides write methods in the following variations: Write(Object), WriteLine(Object), WriteIf(Boolean, Object), and WriteLineIf(Boolean, Object).

You can customize the tracing output's target by adding TraceListener instances to or removing instances from the Listeners collection. By default, trace output is emitted using the DefaultTraceListener class.

The TraceHelper class provides properties to get or set the level of Indent()()(), the IndentSize, and whether to AutoFlush after each write.

Inheritance Hierarchy
Object
TraceHelper
See Also

Assembly: InTheHand.WindowsMobile (Module: InTheHand.WindowsMobile) Version: 3.2.0.0