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

is designed for character input in a particular encoding, whereas the class is designed for byte input and output. Use for reading lines of information from a standard text file.

defaults to UTF-8 encoding unless specified otherwise, instead of defaulting to the ANSI code page for the current system. UTF-8 handles Unicode characters correctly and provides consistent results on localized versions of the operating system. If you get the current character encoding using the property, the value is not reliable until after the first method, since encoding auto detection is not done until the first call to a method.

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

The and method overloads read and write the number of characters specified by the parameter. These are to be distinguished from and , which read and write the number of bytes specified by the parameter. Use the methods only for reading and writing an integral number of byte array elements.

When reading from a , it is more efficient to use a buffer that is the same size as the internal buffer of the stream.

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

Implements a that reads characters from a byte stream in a particular encoding.

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

  This constructor initializes the encoding to , the property using the parameter, and the internal buffer size to 1024 bytes.

  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.

  The stream to be read.
  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.
  The file specified in was not found.
  is an empty string ("").
  is .

  The complete file path is specified by the parameter. This constructor initializes the encoding to and the buffer size to 1024 bytes.

  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 name.

  The complete file path to be read.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  does not support reading.
  is .

  This constructor initializes the encoding to , the property using the parameter, and the internal buffer size to 1024 bytes.

  The parameter detects the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. See the method for more information.

  The object calls on the provided object when is called.

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

  Initializes a new instance of the class for the specified stream, with the specified byte order mark detection option.

  The stream to be read.
  Indicates whether to look for byte order marks at the beginning of the file.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  does not support reading.
  or is .

  The character encoding is set by the parameter, and the buffer size is set to 1024 bytes. The object attempts to detect the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information.

  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, with the specified character encoding.

  The stream to be read.
  The character encoding to use.
  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.
  The file specified in was not found.
  is an empty string ("").
  is .

  This constructor initializes the encoding to , the property using the parameter, and the internal buffer size to 1024 bytes.

  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.

  The parameter detects the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the is used. See the method for more information.

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

  Initializes a new instance of the class for the specified file name, with the specified byte order mark detection option.

  The complete file path to be read.
  Indicates whether to look for byte order marks at the beginning of the file.
  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.
  The file specified in was not found.
  is an empty string ("").
  or is .

  This constructor initializes the encoding as specified by the parameter, and the internal buffer size to 1024 bytes. The object attempts to detect the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information.

  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 name, with the specified character encoding.

  The complete file path to be read.
  The character encoding to use.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  does not support reading.
  or is .

  This constructor initializes the encoding as specified by the parameter, the property using the parameter, and the internal buffer size to 1024 bytes.

  The parameter detects the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information.

  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, with the specified character encoding and byte order mark detection option.

  The stream to be read.
  The character encoding to use.
  Indicates whether to look for byte order marks at the beginning of the file.
  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.
  The file specified in was not found.
  is an empty string ("").
  or is .

  This constructor initializes the encoding as specified by the parameter, and the internal buffer size to 1024 bytes.

  The parameter detects the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information.

  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 name, with the specified character encoding and byte order mark detection option.

  The complete file path to be read.
  The character encoding to use.
  Indicates whether to look for byte order marks at the beginning of the file.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  does not support reading.
  or is .
  is less than or equal to zero.

  The buffer size, in number of 16-bit characters, is set by the parameter. If is less than the minimum allowable size (128 characters), the minimum allowable size is used.

  This constructor allows you to change the encoding the first time you read from the object. The parameter detects the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information.

  The object calls on the provided object when is called.

  When reading from a , it is more efficient to use a buffer that is the same size as the internal buffer of the stream.

  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, with the specified character encoding, byte order mark detection option, and buffer size.

  The stream to be read.
  The character encoding to use.
  Indicates whether to look for byte order marks at the beginning of the file.
  The minimum buffer size.
  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.
  The file specified in was not found.
  is an empty string ("").
  or is .
  is less than or equal to zero.

  This constructor initializes the encoding as specified by the parameter.

  This constructor allows you to change the encoding the first time you read from the object. The parameter detects the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information.

  The buffer size, in number of 16-bit characters, is set by the parameter. If is less than the minimum allowable size (128 characters), the minimum allowable size is used.

  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 name, with the specified character encoding, byte order mark detection option, and buffer size.

  The complete file path to be read.
  The character encoding to use.
  Indicates whether to look for byte order marks at the beginning of the file.
  The minimum buffer size, in number of 16-bit characters.
  0
- Constructor
  4.0.0.0

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

  The buffer size, in number of 16-bit characters, is set by the parameter. If is less than the minimum allowable size (128 characters), the minimum allowable size is used.

  This constructor enables you to change the encoding the first time you read from the object. If the parameter is true, the constructor detects the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the method for more information.

  When reading from a , it is more efficient to use a buffer that is the same size as the internal buffer of the stream.

  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 interpreted correctly, and could cause an exception to be thrown.

  Initializes a new instance of the class for the specified stream based on the specified character encoding, byte order mark detection option, and buffer size, and optionally leaves the stream open.

  The stream to read.
  The character encoding to use.
  true to look for byte order marks at the beginning of the file; otherwise, false.
  The minimum buffer size.
  true to leave the stream open after the object is disposed; otherwise, false.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IO.Stream

  The underlying which the current instance is reading.

  You use this property to access the underlying stream. The class buffers input from the underlying stream when you call one of the methods. If you manipulate the position of the underlying stream after reading data into the buffer, the position of the underlying stream might not match the position of the internal buffer. To reset the internal buffer, call the method; however, this method slows performance and should be called only when absolutely necessary. The constructors that have the parameter can change the encoding the first time you read from the object.

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

  Returns the underlying stream.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  This method overrides the method.

  This implementation of calls the method passing a true value.

  Flushing the stream will not flush its underlying encoder unless you explicitly call . 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 be encoded only after the encoder receives the adjacent character or characters.

  Following a call to , any operations on the reader might raise exceptions.

  Closes the object and the underlying stream, and releases any system resources associated with the reader.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Text.Encoding The current used by the current reader.

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

  Gets the current character encoding that the current object is using.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  Use the method to reset the internal buffer for the object. You need to call this method only when the position of the internal buffer and the do not match. These positions can become mismatched when you read data into the buffer and then seek a new position in the underlying stream. This method slows performance and should be used only when absolutely necessary, such as when you want to read a portion of the contents of a object more than once.

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

  Clears the internal buffer.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  This method is called by the public method and the method. invokes the protected method with the parameter set to true. invokes with set to false.

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

  .

  Closes the underlying stream, 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
  2.0.0.0
  4.0.0.0
  System.Boolean To be added. To be added.

  Gets a value that indicates whether the current stream position is at the end of the stream.

- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IO.StreamReader

  When read methods are invoked on , zero is always returned. When is invoked on , null is returned.

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

  A object around an empty stream.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 An I/O error occurred.

  The method returns an integer value in order to determine whether the end of the file, or another error has occurred. This allows a user to first check if the returned value is -1 before casting it to a type.

  This method overrides .

  The current position of the object is not changed by .

  Returns the next available character but does not consume it.

  An integer representing the next character to be read, or -1 if there are no characters to be read or if the stream does not support seeking.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 An I/O error occurred.

  This method overrides .

  This method returns an integer so that it can return -1 if the end of the stream has been reached. If you manipulate the position of the underlying stream after reading data into the buffer, the position of the underlying stream might not match the position of the internal buffer. To reset the internal buffer, call the method; however, this method slows performance and should be called only when absolutely necessary.

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

  Reads the next character from the input stream and advances the character position by one character.

  The next character from the input stream represented as an object, or -1 if no more characters are available.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` .Length - < . is . or is negative.

  An I/O error occurred.

  -or-

  The current stream is closed.

  This method overrides .

  This method returns an integer so that it can return 0 if the end of the stream has been reached.

  When using the method, it is more efficient to use a buffer that is the same size as the internal buffer of the stream, where the internal buffer is set to your desired block size, and to always read less than the block size. If the size of the internal buffer was unspecified when the stream was constructed, its default size is 4 kilobytes (4096 bytes). If you manipulate the position of the underlying stream after reading data into the buffer, the position of the underlying stream might not match the position of the internal buffer. To reset the internal buffer, call the method; however, this method slows performance and should be called only when absolutely necessary.

  This method returns after either the number of characters specified by the parameter are read, or the end of the file is reached. is a blocking version of .

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

  Reads a specified maximum of characters from the current stream into a buffer, beginning at the specified index.

  The number of characters that have been read, or 0 if at the end of the stream and no data was read. The number will be less than or equal to the parameter, depending on whether the data is available within the stream.

  When this method returns, contains the specified character array with the values between and () replaced by the characters read from the current source. The index of at which to begin writing. The maximum number of characters to read. 0
- Method
  4.0.0.0
  System.Threading.Tasks.Task<System.Int32> `` `` ``

  The task completes after either the number of characters specified by the parameter are read or the end of the stream is reached.

  Reads a specified maximum number of characters from the current stream asynchronously and writes the data to a buffer, beginning at the specified index.

  A task that represents the asynchronous read operation. The value of the parameter contains the total number of bytes read into the buffer. The result value can be less than the number of bytes requested if the number of bytes currently available is less than the requested number, or it can be 0 (zero) if the end of the stream has been reached.

  When this method returns, contains the specified character array with the values between and ( + - 1) replaced by the characters read from the current source. The position in at which to begin writing. The maximum number of characters to read. If the end of the stream is reached before the specified number of characters is written into the buffer, the current method returns.
- Method
  4.0.0.0
  System.Int32 `` `` ``

  The position of the underlying stream is advanced by the number of characters that were read into .

  The method blocks until either characters are read, or the end of the stream has been reached. This is a blocking version of .

  Reads a specified maximum number of characters from the current stream and writes the data to a buffer, beginning at the specified index.

  The number of characters that have been read. The number will be less than or equal to , depending on whether all input characters have been read.

  When this method returns, contains the specified character array with the values between and () replaced by the characters read from the current source. The position in at which to begin writing. The maximum number of characters to read.
- Method
  4.0.0.0
  System.Threading.Tasks.Task<System.Int32> `` `` ``

  The task does not complete until either the number of characters specified by the parameter are read, or the end of the stream has been reached.

  Reads a specified maximum number of characters from the current stream asynchronously and writes the data to a buffer, beginning at the specified index.

  A task that represents the asynchronous read operation. The value of the parameter contains the total number of bytes read into the buffer. The result value can be less than the number of bytes requested if the number of bytes currently available is less than the requested number, or it can be 0 (zero) if the end of the stream has been reached.

  When this method returns, contains the specified character array with the values between and ( + - 1) replaced by the characters read from the current source. The position in at which to begin writing. The maximum number of characters to read. If the end of the stream is reached before the specified number of characters is written into the buffer, the method returns.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String An I/O error occurred. There is insufficient memory to allocate a buffer for the returned string.

  A line is defined as a sequence of characters followed by a line feed ("\n"), a carriage return ("\r"), or a carriage return immediately followed by a line feed ("\r\n"). The string that is returned does not contain the terminating carriage return or line feed. The returned value is null if the end of the input stream is reached.

  This method overrides .

  If the current method throws an , the reader's position in the underlying object is advanced by the number of characters the method was able to read, but the characters already read into the internal buffer are discarded. If you manipulate the position of the underlying stream after reading data into the buffer, the position of the underlying stream might not match the position of the internal buffer. To reset the internal buffer, call the method; however, this method slows performance and should be called only when absolutely necessary.

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

  Reads a line of characters from the current stream and returns the data as a string.

  The next line from the input stream, or null if the end of the input stream is reached.

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

  Reads a line of characters asynchronously from the current stream and returns the data as a string.

  A task that represents the asynchronous read operation. The value of the parameter contains the next line from the stream, or is null if all the characters have been read.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String An I/O error occurred. There is insufficient memory to allocate a buffer for the returned string.

  This method overrides .

  works best when you need to read all the input from the current position to the end of the stream. If more control is needed over how many characters are read from the stream, use the method overload, which generally results in better performance.

  assumes that the stream knows when it has reached an end. For interactive protocols in which the server sends data only when you ask for it and does not close the connection, might block indefinitely because it does not reach an end, and should be avoided.

  Note that when using the method, it is more efficient to use a buffer that is the same size as the internal buffer of the stream. If the size of the buffer was unspecified when the stream was constructed, its default size is 4 kilobytes (4096 bytes).

  If the current method throws an , the reader's position in the underlying object is advanced by the number of characters the method was able to read, but the characters already read into the internal buffer are discarded. If you manipulate the position of the underlying stream after reading data into the buffer, the position of the underlying stream might not match the position of the internal buffer. To reset the internal buffer, call the method; however, this method slows performance and should be called only when absolutely necessary.

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

  Reads all characters from the current position to the end of the stream.

  The rest of the stream as a string, from the current position to the end. If the current position is at the end of the stream, returns an empty string ("").

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

  Reads all characters from the current position to the end of the stream asynchronously and returns them as one string.

  A task that represents the asynchronous read operation. The value of the parameter contains a string with the characters from the current position to the end of the stream.

0