StreamWriter Constructor (Stream, Encoding, Int32, Boolean)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Initializes a new instance of the StreamWriter class for the specified stream, using the specified encoding, buffer size, and a value that specifies whether to leave the stream open.
Assembly: mscorlib (in mscorlib.dll)
When leaveOpen is true, the stream is left open after the StreamReader object is disposed. Otherwise, the StreamWriter object calls Dispose on the provided Stream object when StreamWriter.Dispose is called.
When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
Windows PhoneIf you pass an invalid input path to a StreamWriter constructor, the constructor throws InvalidArgumentException instead of DirectoryNotFoundException.