Trace.AutoFlush 属性

定义

获取或设置每次写入后是否应在 Listeners 上调用 Flush()Gets or sets whether Flush() should be called on the Listeners after every write.

public:
 static property bool AutoFlush { bool get(); void set(bool value); };
public static bool AutoFlush { get; set; }
member this.AutoFlush : bool with get, set
Public Shared Property AutoFlush As Boolean

属性值

Boolean

如果每次写入后在 Listeners 上调用 Flush(),则为 true;否则为 falsetrue if Flush() is called on the Listeners after every write; otherwise, false.

注解

默认值为 falseThe default is false.

除非显式调用或,否则刷新流将不会刷新其基础编码器 Flush CloseFlushing the stream will not flush its underlying encoder unless you explicitly call Flush or Close. 如果设置为,则 AutoFlush true 表示将数据从缓冲区刷新到流,但不会刷新编码器状态。Setting AutoFlush to true means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. 这样,编码器就可以将其状态保留 (部分字符) 以便它能够正确地编码下一个字符块。This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. 此方案影响 UTF8 和 UTF7,其中某些字符只能在编码器接收到相邻字符后编码。This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.

若要为 AutoFlush 设置 IndentSizeTrace ,还可以编辑与应用程序名称对应的配置文件。To set the AutoFlush and IndentSize for Trace, you can also edit the configuration file that corresponds to the name of your application. 配置文件的格式应类似于以下示例:The configuration file should be formatted like the following example:

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

适用于

另请参阅