StreamWriter Constructor
.NET Framework 3.5
Initializes a new instance of the StreamWriter class.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
| Name | Description | |
|---|---|---|
|
StreamWriter(Stream) | Initializes a new instance of the StreamWriter class for the specified stream, using UTF-8 encoding and the default buffer size. |
|
StreamWriter(String) | Initializes a new instance of the StreamWriter class for the specified file on the specified path, using the default encoding and buffer size. |
|
StreamWriter(Stream, Encoding) | Initializes a new instance of the StreamWriter class for the specified stream, using the specified encoding and the default buffer size. |
|
StreamWriter(String, Boolean) | Initializes a new instance of the StreamWriter class for the specified file on the specified path, using the default encoding and buffer size. If the file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file. |
|
StreamWriter(Stream, Encoding, Int32) | Initializes a new instance of the StreamWriter class for the specified stream, using the specified encoding and buffer size. |
|
StreamWriter(String, Boolean, Encoding) | Initializes a new instance of the StreamWriter class for the specified file on the specified path, using the specified encoding and default buffer size. If the file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file. |
|
StreamWriter(String, Boolean, Encoding, Int32) | Initializes a new instance of the StreamWriter class for the specified file on the specified path, using the specified encoding and buffer size. If the file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file. |
Default encoding
StreamWriter(String) does NOT use the default encoding. Call StreamWriter(String, Boolean, Encoding) with the parameter Encoding set to Encoding.Default instead.
- 3/3/2010
- ReneDenmark
- 3/3/2010
- ReneDenmark
Globalization
Why there is no constructor overload that takes formatProvider and pass it to base TextWriter constructor?
When I need culture aware writing I should fallback to using WriteLine(string) method only and pass cultureInfo per each call via using string.Format(IFormatProvider provider, string format,...).
- 4/28/2009
- Andrey Titov
- 4/28/2009
- Andrey Titov