Trace.IndentLevel 屬性

定義

取得或設定縮排層級。

public:
 static property int IndentLevel { int get(); void set(int value); };
public static int IndentLevel { get; set; }
static member IndentLevel : int with get, set
Public Shared Property IndentLevel As Integer

屬性值

縮排層級。 預設值是零。

範例

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

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  

備註

屬性 IndentLevel 代表套用大小 IndentSize 縮排的次數。 此屬性會以每一線程/每個要求為基礎儲存。

適用於

另請參閱