BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.IO.TextWriter

Implements a wrapper that writes characters to a stream in a particular encoding.

The class is designed for character output in a particular , whereas subclasses of are designed for byte input and output.

defaults to using an instance of unless specified otherwise. This instance of is constructed such that the method returns the Unicode byte order mark written in UTF-8. The preamble of the encoding is added to a stream when you are not appending to an existing stream. This means any text file you create with has three byte order marks at its beginning. UTF-8 handles all Unicode characters correctly and gives consistent results on localized versions of the operating system.

By default, is not thread safe. For a thread-safe wrapper, see .

- Constructor
  The to write to.

  Constructs and initializes a new instance of the class for the specified stream, using the default encoding and buffer size.

  This constructor initializes the property to a whose method returns an empty byte array. For additional information, see . The property is initialized using .

  The default buffer size can typically be around 4 KB.

  does not support writing.
  is .
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that specifies the complete file path to write to.

  Constructs and initializes a new instance of the class for the specified file on the specified path, using the default encoding and buffer size.

  This constructor initializes the property to a whose method returns an empty byte array. For additional information, see .

  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 .

  The default buffer size can typically be around 4 KB.

  is in an invalid format or contains invalid characters.
  The directory information specified in was not found.
  Access to is denied.
  is an empty string ("").
  is .
  The caller does not have the required permission.
  Requires permission for reading and writing files. See ,
  The length of or the absolute path information for exceeds the implementation-specific maximum length.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  The to write to.
  A that specifies the character encoding to use.

  Constructs and initializes a new instance of the class for the specified stream, using the specified encoding and the default buffer size.

  This constructor initializes the property using , and the property using . For additional information, see .

  The default buffer size can typically be around 4 KB.

  or is .
  does not support writing.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that specifies the complete file path to write to.
  A value that determines whether data is to be appended to the file. If the file exists and is , the file is overwritten. If the file exists and is , the data is appended to the file. Otherwise, a new file is created.

  Constructs and initializes a new instance of the class for the specified file on the specified path, using the default encoding and buffer size.

  This constructor initializes the property to whose method returns an empty byte array. For additional information, see .

  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.

  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 .

  The default buffer size can typically be around 4 KB.

  A general I/O exception occurs, such as trying to access a CD-ROM drive whose tray is open
  The directory information specified in was not found.
  Access to is denied. The caller does not have the required permission.
  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.
  is .
  The caller does not have the required permission.
  Requires permission for reading and writing files. See ,
  is in an implementation-specific invalid format.
  The length of or the absolute path information for exceeds the implementation-specific maximum length.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  The to write to.
  A that specifies the character encoding to use.
  A that specifies the buffer size.

  Constructs and initializes a new instance of the class for the specified stream, using the specified encoding and buffer size.

  This constructor initializes the property using , and the property using . For additional information, see .

  or is .
  is negative.
  does not support writing.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that specifies the complete file path to write to.
  A value that determines whether data is to be appended to the file. If the file exists and is , the file is overwritten. If the file exists and is , the data is appended to the file. Otherwise, a new file is created.
  A that specifies the character encoding to use.

  Constructs and initializes a new instance of the class for the specified file on the specified path, using the specified encoding and default buffer size.

  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 property using . For additional information, see .

  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 .

  The default buffer size can typically be around 4 KB.

  A general I/O exception occurred, such as trying to access a CD-ROM drive whose tray is open.
  The directory information specified in was not found.
  Access is denied. The caller does not have the required permission.
  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.
  or is .
  The caller does not have the required permission.
  Requires permission for reading and writing files. See ,
  is in an implementation-specific invalid format.
  The length of or the absolute path information for exceeds the implementation-specific maximum length.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that specifies the complete file path to write to.
  A value that determines whether data is to be appended to the file. If the file exists and is , the file is overwritten. If the file exists and is , the data is appended to the file. Otherwise, a new file is created.
  A that specifies the character encoding to use.
  A that specifies the buffer size.

  Constructs and initializes a new instance of the class for the specified file on the specified path, using the specified encoding and buffer size.

  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 property using . For additional information, see .

  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 .

  A general I/O exception occurred, such as trying to access a CD-ROM drive whose tray is open.
  The directory information specified in was not found.
  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.
  or is .
  is negative.
  The caller does not have the required permission.
  Access is denied. The caller does not have the required permission.
  Requires permission for reading and writing files. See ,
  is in an implementation-specific invalid format.
  The length of or the absolute path information for exceeds the implementation-specific maximum length.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.Boolean

  Gets or sets a value indicating whether the current will flush its buffer to the underlying stream after every call to .

  to force to flush its buffer; otherwise, .

  The will do a limited amount of buffering, both internally and potentially in the encoder from the encoding you passed in. If is set to , the data will be flushed into the underlying stream only when the buffer is full, or when () or is called.

  Setting to forces to flush the buffered data out of the encoder and call on the stream every time is called.

  As described above.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.IO.Stream

  Gets the underlying stream.

  The the current instance is writing to.

  As described above.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Void

  Closes the current and the underlying stream.

  This method calls , writing buffered data to the underlying stream. Following a call to , any operations on the current instance might raise exceptions.

  This version of is equivalent to ().

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Void `` to release both managed and unmanaged resources; to release only unmanaged resources.

  Releases the unmanaged resources used by the and optionally releases the managed resources.

  When the parameter is , this method releases all resources held by any managed objects that this references. This method invokes the method of each referenced object.

  can be called multiple times by other objects. When overriding (), be careful not to reference objects that have been previously disposed in an earlier call to .

  This method calls the dispose method of the base class, .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.Text.Encoding

  Gets the in which the output is written.

  The specified in the constructor for the current instance, or if an encoding was not specified.

  This property overrides the property.

  As described above.

  This property is required in some XML scenarios where a header must be written containing the encoding used by the . This allows XML code to consume an arbitrary and generate a correct XML header.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Void

  Releases resources held by the current instance.

  Application code does not call this method; it is automatically invoked by during garbage collection unless finalization by the garbage collector has been disabled. For more information, see , and .

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Void

  Clears all buffers for the current writer and causes any buffered data to be written to the underlying stream.

  This method overrides .

  The current writer is closed. An I/O error occurred. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Field
  System.IO.StreamWriter To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` The to write to the underlying stream.

  Writes a character to the stream.

  The specified character is written to the underlying stream unless the end of the stream is reached prematurely.

  If is , is invoked automatically.

  This method overrides .

  The current writer is closed. is or the buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the is at the end the stream. An I/O error occurred. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` A array containing the data to write. If is , nothing is written.

  Writes a character array to the underlying stream.

  The specified characters are written to the underlying stream unless the end of the stream is reached prematurely.

  If is , is invoked automatically.

  This method overrides .

  The current writer is closed. is or the buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the is at the end the stream. An I/O error occurred. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` The to write to the stream. If is , nothing is written.

  Writes a string to the stream.

  The specified is written to the underlying stream unless the end of the stream is reached prematurely.

  If is , is invoked automatically.

  This method overrides .

  The current writer is closed. is or the buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the is at the end the stream. An I/O error occurred. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` `` A array containing the data to write. A that specifies the index into at which to begin writing. A that specifies the number of characters to read from .

  Writes a sub-array of characters to the underlying stream.

  The specified characters are written to the underlying stream unless the end of the stream is reached prematurely.

  If is , is invoked automatically.

  This method overrides .

  is . buffer.Length - < . or is negative. The current writer is closed. is or the buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the is at the end the stream. An I/O error occurred. 0 1.0.5000.0 2.0.0.0 4.0.0.0
0 System.Runtime.InteropServices.ComVisible(true)