Trace.IndentLevel 属性

定义

获取或设置缩进级别。Gets or sets the indent level.

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

属性值

Int32

缩进级别。The indent level. 默认值为 0。The default is zero.

示例

下面的示例将递增和递减缩进级别并发出跟踪消息。The following example increments and decrements the indent level and emits tracing messages.

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

该示例产生下面的输出:This example produces the following output:

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

注解

IndentLevel属性表示应用大小缩进的次数 IndentSizeThe IndentLevel property represents the number of times the indent of size IndentSize is applied. 此属性基于每个线程/每个请求存储。This property is stored on per-thread/per-request basis.

适用于

另请参阅