.NET Framework Class Library for Silverlight
StreamWriter Constructor (Stream, Encoding)
Initializes a new instance of the StreamWriter class for the specified stream, using the specified encoding and the default buffer size.
Namespace:
System.IO
Assembly:
mscorlib (in mscorlib.dll)

Syntax
Visual Basic (Declaration)
Public Sub New ( _
stream As Stream, _
encoding As Encoding _
)
public StreamWriter(
Stream stream,
Encoding encoding
)

Exceptions

Remarks
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
If you pass an invalid input path to a StreamWriter constructor, the constructor throws InvalidArgumentException instead of DirectoryNotFoundException.

Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
XNA Framework
Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

See Also