StreamWriter Constructor (Stream, Encoding, Int32)
Initializes a new instance of the StreamWriter class for the specified stream, using the specified encoding and buffer size.
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Parameters
- stream
- Type: System.IO::Stream
The stream to write to.
- encoding
- Type: System.Text::Encoding
The character encoding to use.
- bufferSize
- Type: System::Int32
The buffer size.
| Exception | Condition |
|---|---|
| ArgumentNullException | stream or encoding is nullptr. |
| ArgumentOutOfRangeException | bufferSize is negative. |
| ArgumentException | stream is not writable. |
This constructor initializes the Encoding property using the encoding parameter, and the BaseStream property using the stream parameter. For additional information, see Encoding.
The StreamWriter object calls Dispose on the provided Stream object when StreamWriter::Dispose is called.
Caution: |
|---|
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. |
Platform Notes
Silverlight for Windows Phone
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Caution: