Mono Class Library: System.IO.StreamWriter Overview | MembersSystem.IO.StreamWriter Constructor |
Constructs and initializes a new instance of the System.IO.StreamWriter class for the specified file on the specified path, using the specified encoding and buffer size. [Edit]
|
- path
- A string that specifies the complete file path to write to. [Edit]
- append
- A bool value that determines whether data is to be appended to the file. If the file exists and append is false, the file is overwritten. If the file exists and append is true, the data is appended to the file. Otherwise, a new file is created. [Edit]
- encoding
- A System.Text.Encoding that specifies the character encoding to use. [Edit]
- bufferSize
- A int that specifies the buffer size. [Edit]
Type Reason System.Security.Permissions.FileIOPermission [Edit] Requires permission for reading and writing files. See System.Security.Permissions.FileIOPermissionAccess.Read, System.Security.Permissions.FileIOPermissionAccess.Write
Type Reason System.IO.IOException A general I/O exception occurred, such as trying to access a CD-ROM drive whose tray is open. [Edit] System.IO.DirectoryNotFoundException The directory information specified in path was not found. [Edit] ArgumentException path is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. [Edit] ArgumentNullException path or encoding is null. [Edit] ArgumentOutOfRangeException bufferSize is negative. [Edit] System.Security.SecurityException The caller does not have the required permission. [Edit] UnauthorizedAccessException Access is denied. The caller does not have the required permission. [Edit] System.IO.NotSupportedException path is in an implementation-specific invalid format. [Edit] System.IO.PathTooLongException The length of path or the absolute path information for path exceeds the implementation-specific maximum length. [Edit]
If the specified file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file.
This constructor initializes the StreamWriter.Encoding property using encoding . For additional information, see TextWriter.Encoding.
Note:[Edit]path is not required to be a file stored on disk; it can be any part of a system that supports access via streams. For example, depending on the system, this class might be able to access a physical device.
For information on the valid format and characters for path strings, see System.IO.Path .
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0