共用方式為


Trace.Indent 方法

定義

將目前的 IndentLevel 加一。

public:
 static void Indent();
[System.Diagnostics.Conditional("TRACE")]
public static void Indent ();
[<System.Diagnostics.Conditional("TRACE")>]
static member Indent : unit -> unit
Public Shared Sub Indent ()
屬性

範例

下列範例會遞增和遞減縮排層級,併發出追蹤訊息。

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" );
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");
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")

這個範例會產生下列輸出:

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

適用於

另請參閱