This documentation is archived and is not being maintained.

Trace.IndentLevel Property

Gets or sets the indent level.

[Visual Basic]
Public Shared Property IndentLevel As Integer
[C#]
public static int IndentLevel {get; set;}
[C++]
public: __property static int get_IndentLevel();
public: __property static void set_IndentLevel(int);
[JScript]
public static function get IndentLevel() : int;
public static function set IndentLevel(int);

Property Value

The indent level. The default is zero.

Remarks

This property is stored on per-thread/per-request basis.

Example

The following example increments and decrements the indent level and emits tracing messages.

[Visual Basic] 
Trace.WriteLine("List of errors:")
Trace.Indent()
Trace.WriteLine("Error 1: File not found")
Trace.WriteLine("Error 2: Directory not found")
Trace.Unindent()
Trace.WriteLine("End of list of errors")


[C#] 
Trace.WriteLine("List of errors:");
 Trace.Indent();
 Trace.WriteLine("Error 1: File not found");
 Trace.WriteLine("Error 2: Directory not found");
 Trace.Unindent();
 Trace.WriteLine("End of list of errors");
   

[C++] 
Trace::WriteLine(S"List of errors:");
 Trace::Indent();
 Trace::WriteLine(S"Error 1: File not found");
 Trace::WriteLine(S"Error 2: Directory not found");
 Trace::Unindent();
 Trace::WriteLine(S"End of list of errors");
   

[JScript] 
Trace.WriteLine("List of errors:")
Trace.Indent()
Trace.WriteLine("Error 1: File not found")
Trace.WriteLine("Error 2: Directory not found")
Trace.Unindent()
Trace.WriteLine("End of list of errors")

This example produces the following output:

List of errors:
     Error 1: File not found
     Error 2: Directory not found
End of list of errors
   

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Trace Class | Trace Members | System.Diagnostics Namespace | IndentSize | Debug | Trace | BooleanSwitch | TraceSwitch | TraceListener | DefaultTraceListener | ConditionalAttribute

Show: