Debug.Indent 方法

定义

将当前 IndentLevel 值增加一个。

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

示例

以下示例设置缩进级别并发出调试消息。

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

此示例生成以下输出:

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

适用于

另请参阅