Trace.IndentSize 屬性

定義

取得或設定縮排的空格數目。

C#
public static int IndentSize { get; set; }

屬性值

縮排中的空格數目。 預設值為 4。

備註

會將 TextWriterTraceListener 這個數位解譯為空格。 EventLogTraceListener忽略此值。

此屬性會以每個線程/每個要求為基礎儲存。

若要在 .NET Framework 應用程式中設定 AutoFlushIndentSizeTrace ,您也可以編輯對應至應用程式名稱的組態檔。 組態檔的格式應該如下列範例所示:

XML
<configuration>  
  <system.diagnostics>  
    <trace autoflush="false" indentsize="3" />  
  </system.diagnostics>  
</configuration>  

適用於

產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

另請參閱