Summary
Creates a System.IO.StreamWriter for the specified stream. The
biggest difference between this and creating a System.IO.StreamWriter
directly is that the new System.IO.StreamWriter will default to
leaving the underlying stream open on disposal. Remember to flush the
returned writer after all data have been written.
Syntax
public static StreamWriter GetWriter(this Stream stream, bool leaveOpen = true)
Parameters
| Name |
Type |
Description |
| stream |
Stream |
The stream to write to. |
| leaveOpen |
bool |
true to leave the underlying stream open on disposal. |
Return Value
| Type |
Description |
| StreamWriter |
A new System.IO.StreamWriter for the specified stream. |