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 缩进的次数。 此属性基于每个线程/每个请求存储。

适用于

另请参阅