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 System.Runtime.InteropServices.ComVisible(true)

is designed for character output in a particular encoding, whereas classes derived from are designed for byte input and output.

defaults to using an instance of unless specified otherwise. This instance of UTF8Encoding is constructed without a byte order mark (BOM), so its method returns an empty byte array. The default UTF-8 encoding for this constructor throws an exception on invalid bytes. This behavior is different from the behavior provided by the encoding object in the property. To specify a BOM and determine whether an exception is thrown on invalid bytes, use a constructor that accepts an encoding object as a parameter, such as or .

By default, a is not thread safe. See for a thread-safe wrapper.

For a list of common I/O tasks, see Common I/O Tasks.

Implements a for writing characters to a stream in a particular encoding.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  does not support writing.
  is .

  This constructor creates a with UTF-8 encoding without a Byte-Order Mark (BOM), so its method returns an empty byte array. The default UTF-8 encoding for this constructor throws an exception on invalid bytes. This behavior is different from the behavior provided by the encoding object in the property. To specify whether an exception is thrown on invalid bytes, use a constructor that accepts an encoding object as a parameter, such as . The property is initialized using the parameter. The position of the stream is not reset.

  The object calls on the provided object when is called.

  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.

  For a list of common I/O tasks, see Common I/O Tasks.

  Initializes a new instance of the class for the specified stream by using UTF-8 encoding and the default buffer size.

  The stream to write to.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  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.

  This constructor creates a with UTF-8 encoding without a Byte-Order Mark (BOM), so its method returns an empty byte array. The default UTF-8 encoding for this constructor throws an exception on invalid bytes. This behavior is different from the behavior provided by the encoding object in the property. To specify a BOM and determine whether an exception is thrown on invalid bytes, use a constructor that accepts an encoding object as a parameter, such as .

  The parameter can be a file name, including a file on a Universal Naming Convention (UNC) share. If the file exists, it is overwritten; otherwise, a new file is created.

  The parameter is not required to be a file stored on disk; it can be any part of a system that supports access using streams.

  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.

  For a list of common I/O tasks, see Common I/O Tasks.

  Initializes a new instance of the class for the specified file by using the default encoding and buffer size.

  The complete file path to write to. can be a file name.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  or is .
  does not support writing.

  This constructor initializes the property using the encoding parameter, and the property using the stream parameter. The position of the stream is not reset. For additional information, see .

  The object calls on the provided object when is called.

  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.

  For a list of common I/O tasks, see Common I/O Tasks.

  Initializes a new instance of the class for the specified stream by using the specified encoding and the default buffer size.

  The stream to write to.
  The character encoding to use.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  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.

  This constructor creates a with UTF-8 encoding without a Byte-Order Mark (BOM), so its method returns an empty byte array. The default UTF-8 encoding for this constructor throws an exception on invalid bytes. This behavior is different from the behavior provided by the encoding object in the property. To specify a BOM and determine whether an exception is thrown on invalid bytes, use a constructor that accepts an encoding object as a parameter, such as .

  The parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.

  The parameter is not required to be a file stored on disk; it can be any part of a system that supports access using streams.

  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.

  For a list of common I/O tasks, see Common I/O Tasks.

  Initializes a new instance of the class for the specified file by 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.

  The complete file path to write to.
  true to append data to the file; false to overwrite the file. If the specified file does not exist, this parameter has no effect, and the constructor creates a new file.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  or is .
  is negative.
  does not support writing.

  This constructor initializes the property using the parameter, and the property using the parameter. The position of the stream is not reset. For additional information, see .

  The object calls on the provided object when is called.

  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.

  For a list of common I/O tasks, see Common I/O Tasks.

  Initializes a new instance of the class for the specified stream by using the specified encoding and buffer size.

  The stream to write to.
  The character encoding to use.
  The buffer size, in bytes.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  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.

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

  can be a file name, including a file on a Universal Naming Convention (UNC) share.

  is not required to be a file stored on disk; it can be any part of a system that supports access via streams.

  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.

  For a list of common I/O tasks, see Common I/O Tasks.

  Initializes a new instance of the class for the specified file by 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.

  The complete file path to write to.
  true to append data to the file; false to overwrite the file. If the specified file does not exist, this parameter has no effect, and the constructor creates a new file.
  The character encoding to use.
  0
- Constructor
  4.0.0.0

  Unless you set the parameter to true, the object calls on the provided object when is called.

  This constructor initializes the property by using the parameter, and initializes the property by using the parameter. The position of the stream is not reset. For additional information, see the property.

  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.

  Initializes a new instance of the class for the specified stream by using the specified encoding and buffer size, and optionally leaves the stream open.

  The stream to write to.
  The character encoding to use.
  The buffer size, in bytes.
  true to leave the stream open after the object is disposed; otherwise, false.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  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.

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

  can be a file name, including a file on a Universal Naming Convention (UNC) share.

  is not required to be a file stored on disk; it can be any part of a system that supports access via streams.

  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.

  For a list of common I/O tasks, see Common I/O Tasks.

  Initializes a new instance of the 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.

  The complete file path to write to.
  true to append data to the file; false to overwrite the file. If the specified file does not exist, this parameter has no effect, and the constructor creates a new file.
  The character encoding to use.
  The buffer size, in bytes.
  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  to force to flush its buffer; otherwise, .

  Flushing the stream will not flush its underlying encoder unless you explicitly call or . Setting to true means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.

  When AutoFlush is set to false, StreamWriter will do a limited amount of buffering, both internally and potentially in the encoder from the encoding you passed in. You can get better performance by setting AutoFlush to false, assuming that you always call Close (or at least Flush) when you're done writing with a StreamWriter.

  For example, set AutoFlush to true when you are writing to a device where the user expects immediate feedback. Console.Out is one of these cases: The StreamWriter used internally for writing to Console flushes all its internal state except the encoder state after every call to .

  For a list of common I/O tasks, see Common I/O Tasks.

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

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IO.Stream

  The the current instance is writing to.

  For a list of common I/O tasks, see Common I/O Tasks.

  Gets the underlying stream that interfaces with a backing store.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  This method overrides .

  This implementation of calls the method passing a true value.

  You must call to ensure that all data is correctly written out to the underlying stream. Following a call to , any operations on the might raise exceptions. If there is insufficient space on the disk, calling will raise an exception.

  Flushing the stream will not flush its underlying encoder unless you explicitly call or . Setting to true means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.

  Closes the current StreamWriter object and the underlying stream.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

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

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

  true to release both managed and unmanaged resources; false to release only unmanaged resources. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Text.Encoding

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

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

  For a list of common I/O tasks, see Common I/O Tasks.

  Gets the in which the output is written.

  0
- Method
  System.Void

  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 .

  Frees the resources of the current before it is reclaimed by the garbage collector.

  0
  1.0.5000.0
  2.0.0.0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void The current writer is closed. An I/O error occurred.

  This method overrides .

  Flushing the stream will not flush its underlying encoder unless you explicitly call Flush or . Setting to true means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.

  For a list of common I/O tasks, see Common I/O Tasks.

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

  0
- Method
  4.0.0.0
  System.Threading.Tasks.Task To be added.

  Clears all buffers for this stream asynchronously and causes any buffered data to be written to the underlying device.

  A task that represents the asynchronous flush operation.

- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IO.StreamWriter

  Use Null to redirect output to a StreamWriter that will not consume any operating system resources.

  When the StreamWriter.Write methods are invoked on Null, the call simply returns, and no data is actually written to any backing store.

  For a list of common I/O tasks, see Common I/O Tasks.

  Provides a StreamWriter with no backing store that can be written to, but not read from.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` 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.

  This method overrides .

  The specified character is written to the underlying stream unless the end of the stream is reached prematurely. If is true, is invoked automatically.

  For a list of common I/O tasks, see Common I/O Tasks.

  Writes a character to the stream.

  The character to write to the stream. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` 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.

  This method overrides .

  The specified characters are written to the underlying stream unless the end of the stream is reached prematurely. If is true, is invoked automatically.

  This method might provide faster performance than Write ( ) because it has fewer arguments to check.

  For a list of common I/O tasks, see Common I/O Tasks.

  Writes a character array to the stream.

  A character array containing the data to write. If is null, nothing is written. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` 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.

  This method overrides .

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

  is invoked automatically if is true. If is null, no entries are written.

  For a list of common I/O tasks, see Common I/O Tasks.

  Writes a string to the stream.

  The string to write to the stream. If is null, nothing is written. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` 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.

  This method overrides .

  The characters are read from beginning at and continuing through + ( - 1). All characters are written to the underlying stream unless the end of the underlying stream is reached prematurely. is invoked automatically if is true.

  For a list of common I/O tasks, see Common I/O Tasks.

  Writes a subarray of characters to the stream.

  A character array that contains the data to write. The character position in the buffer at which to start reading data. The maximum number of characters to write. 0
- Method
  4.0.0.0
  System.Threading.Tasks.Task `` To be added.

  Writes a character to the stream asynchronously.

  A task that represents the asynchronous write operation.

  The character to write to the stream.
- Method
  4.0.0.0
  System.Threading.Tasks.Task `` To be added.

  Writes a string to the stream asynchronously.

  A task that represents the asynchronous write operation.

  The string to write to the stream. If is null, nothing is written.
- Method
  4.0.0.0
  System.Threading.Tasks.Task `` `` `` To be added.

  Writes a subarray of characters to the stream asynchronously.

  A task that represents the asynchronous write operation.

  A character array that contains the data to write. The character position in the buffer at which to begin reading data. The maximum number of characters to write.
- Method
  4.0.0.0
  System.Threading.Tasks.Task

  The line terminator is defined by the property.

  Writes a line terminator asynchronously to the stream.

  A task that represents the asynchronous write operation.

- Method
  4.0.0.0
  System.Threading.Tasks.Task ``

  The line terminator is defined by the property.

  Writes a character followed by a line terminator asynchronously to the stream.

  A task that represents the asynchronous write operation.

  The character to write to the stream.
- Method
  4.0.0.0
  System.Threading.Tasks.Task ``

  The line terminator is defined by the property.

  Writes a string followed by a line terminator asynchronously to the stream.

  A task that represents the asynchronous write operation.

  The string to write. If the value is null, only a line terminator is written.
- Method
  4.0.0.0
  System.Threading.Tasks.Task `` `` ``

  The line terminator is defined by the property.

  Writes a subarray of characters followed by a line terminator asynchronously to the stream.

  A task that represents the asynchronous write operation.

  The character array to write data from. The character position in the buffer at which to start reading data. The maximum number of characters to write.
0