Trace.AutoFlush 屬性
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public:
static property bool AutoFlush { bool get(); void set(bool value); };
C#
public static bool AutoFlush { get; set; }
static member AutoFlush : bool with get, set
Public Shared Property AutoFlush As Boolean
如果每次寫入後會在 Listeners 上呼叫 Flush(),則為 true
,否則為 false
。
預設為 false
。
除非您明確呼叫 Flush 或 Close,否則清除數據流不會排清其基礎編碼器。 設定 AutoFlush 為 true
表示數據會從緩衝區排清到數據流,但不會清除編碼器狀態。 這可讓編碼器保持其狀態 (部分字元) ,以便正確編碼下一個字元區塊。 此案例會影響UTF8和UTF7,其中某些字元只能在編碼器收到相鄰字元或字元之後進行編碼。
若要在 .NET Framework 應用程式中設定 AutoFlush 和 IndentSizeTrace ,您也可以編輯對應至應用程式名稱的組態檔。 組態檔的格式應該如下列範例所示:
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 |