
ctor(string path, bool append, Encoding encoding, int bufferSize) If the file does not exist, this constructor creates a new file. If the file exists, it can be either overwritten or appended to. Initializes a new instance of the StreamWriter class for the specified file on the specified path, using the specified encoding and default buffer size. ctor(string path, bool append, Encoding encoding) Initializes a new instance of the StreamWriter class for the specified stream, using the specified encoding and buffer size. ctor(Stream stream, Encoding encoding, int bufferSize)

Initializes a new instance of the StreamWriter class for the specified file on the specified path, using the default encoding and buffer size. Initializes a new instance of the StreamWriter class for the specified stream, using the specified encoding and the default buffer size. Initializes a new instance of the StreamWriter class for the specified stream, using the default encoding and buffer size. See also: System.IO Namespace | Stream | StreamReader | Encoder | Encoding System.IO.StreamWriter Member List: Public Constructors ctor #1 See TextWriter.Synchronized for a thread-safe wrapper.

UTF-8 handles all Unicode characters correctly and gives consistent results on localized versions of the operating system.īy default, a StreamWriter is not thread safe. This means any text file you create with StreamWriter will have three byte order marks at its beginning. The preamble of the encoding is added to a stream when you are not appending to an existing stream. This instance of UTF8Encoding is constructed such that the Encoding.GetPreamble method returns the Unicode byte order mark written in UTF-8. StreamWriter defaults to using an instance of UTF8Encoding unless specified otherwise. Remarks StreamWriter is designed for character output in a particular Encoding, whereas classes derived from Stream are designed for byte input and output.

Summary Implements a TextWriter for writing characters to a stream in a particular encoding. Type: System.IO.StreamWriter System.IO.StreamWriter Class Assembly: Mscorlib.dll
