Stream
冲洗 a后是否需要冲洗 a StreamWriter
?
public static async Task WriteStringAsync(this Stream stream, string messageString)
{
var encoding = new UTF8Encoding(false); //no BOM
using (var streamWriter = new StreamWriter(stream, encoding))
{
await streamWriter.WriteAsync(messageString);
await streamWriter.FlushAsync();
}
await stream.FlushAsync(); //is this necessary?
}