This documentation is archived and is not being maintained.

Debug.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 0.

Remarks

Debug stores this property on a per-thread/per-request basis.

Example

The following example sets the indent level and emits debugging messages.

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

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

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

[JScript] 
Debug.WriteLine("List of errors:");
Debug.Indent();
Debug.WriteLine("Error 1: File not found");
Debug.WriteLine("Error 2: Directory not found");
Debug.Unindent();
Debug.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, .NET Compact Framework

See Also

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

Show: