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)

The following table lists examples of other typical or related I/O tasks.

To do this...

See the example in this topic...

Create a text file.

[<topic://cpconwritingtexttofile>]

Write to a text file.

[<topic://cpconwritingtexttofile>]

Read from a text file.

[<topic://cpconreadingtextfromfile>]

Append text to a file.

[<topic://cpconopeningappendingtologfile>]

Get the size of a file.

Get the attributes of a file.

Set the attributes of a file.

Determine if a file exists.

Read from a binary file.

[<topic://cpconReadingWritingToNewlyCreatedDataFile>]

Write to a binary file.

[<topic://cpconReadingWritingToNewlyCreatedDataFile>]

Implements a that reads from a string.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  is .

  The following table lists examples of other typical or related I/O tasks.

  To do this...

  See the example in this topic...

  Create a text file.

  [<topic://cpconwritingtexttofile>]

  Write to a text file.

  [<topic://cpconwritingtexttofile>]

  Read from a text file.

  [<topic://cpconreadingtextfromfile>]

  Append text to a file.

  [<topic://cpconopeningappendingtologfile>]

  Get the size of a file.

  Get the attributes of a file.

  Set the attributes of a file.

  Determine if a file exists.

  Read from a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

  Write to a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

  Initializes a new instance of the class that reads from the specified string.

  The string to which the should be initialized.
  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  For an example of creating a file and writing text to a file, see [<topic://cpconwritingtexttofile>]. For an example of reading text from a file, see [<topic://cpconreadingtextfromfile>]. For an example of reading from and writing to a binary file, see [<topic://cpconReadingWritingToNewlyCreatedDataFile>].

  This method overrides the method.

  This implementation of Close calls the method passing a true value.

  Flushing the stream will not flush its underlying encoder unless you explicitly call Close. 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.

  Following a call to Close, other methods might throw an exception.

  Closes the .

  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
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 The current reader is closed.

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

  The current position of the StringReader is not changed by this operation.

  The following table lists examples of other typical or related I/O tasks.

  To do this...

  See the example in this topic...

  Create a text file.

  [<topic://cpconwritingtexttofile>]

  Write to a text file.

  [<topic://cpconwritingtexttofile>]

  Read from a text file.

  [<topic://cpconreadingtextfromfile>]

  Get the size of a file.

  Returns the next available character but does not consume it.

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

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 The current reader is closed.

  This method overrides the method.

  The following table lists examples of other typical or related I/O tasks.

  To do this...

  See the example in this topic...

  Create a text file.

  [<topic://cpconwritingtexttofile>]

  Write to a text file.

  [<topic://cpconwritingtexttofile>]

  Read from a text file.

  [<topic://cpconreadingtextfromfile>]

  Append text to a file.

  [<topic://cpconopeningappendingtologfile>]

  Get the size of a file.

  Get the attributes of a file.

  Set the attributes of a file.

  Determine if a file exists.

  Read from a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

  Write to a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

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

  The next character from the underlying string, or -1 if no more characters are available.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` is . ( + ) > Length.

  < 0

  or-

  < 0.

  The current reader is closed.

  This method overrides .

  The method will read up to characters from the into the character array starting at position . Returns the actual number of characters read, or zero if the end of the string has been reached and no characters are read.

  The following table lists examples of other typical or related I/O tasks.

  To do this...

  See the example in this topic...

  Create a text file.

  [<topic://cpconwritingtexttofile>]

  Write to a text file.

  [<topic://cpconwritingtexttofile>]

  Read from a text file.

  [<topic://cpconreadingtextfromfile>]

  Append text to a file.

  [<topic://cpconopeningappendingtologfile>]

  Get the size of a file.

  Get the attributes of a file.

  Set the attributes of a file.

  Determine if a file exists.

  Read from a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

  Write to a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

  Reads a block of characters from the input string and advances the character position by .

  The total number of characters read into the buffer. This can be less than the number of characters requested if that many characters are not currently available, or zero if the end of the underlying string 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 starting index in the buffer. The 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 string is reached.

  Reads a specified maximum number of characters from the current string 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 string 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 string is reached before the specified number of characters is written into the buffer, the method returns.
- 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 string has been reached.

  Reads a specified maximum number of characters from the current string 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 string 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 string 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 The current reader is closed. There is insufficient memory to allocate a buffer for the returned string.

  This method overrides the method.

  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 string has been reached.

  If the current method throws an , the reader's position in the underlying string is advanced by the number of characters the method was able to read, but the characters already read into the internal buffer are discarded. Because the position of the reader in the string cannot be changed, the characters already read are unrecoverable, and can be accessed only by reinitializing the . To avoid such a situation, use the method and store the read characters in a preallocated buffer.

  The following table lists examples of other typical or related I/O tasks.

  To do this...

  See the example in this topic...

  Create a text file.

  [<topic://cpconwritingtexttofile>]

  Write to a text file.

  [<topic://cpconwritingtexttofile>]

  Read from a text file.

  [<topic://cpconreadingtextfromfile>]

  Append text to a file.

  [<topic://cpconopeningappendingtologfile>]

  Get the size of a file.

  Get the attributes of a file.

  Set the attributes of a file.

  Determine if a file exists.

  Read from a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

  Write to a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

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

  The next line from the current string, or null if the end of the string 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 string 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 string reader, 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 The current reader is closed. There is insufficient memory to allocate a buffer for the returned string.

  This method overrides the method.

  If the current method throws an , the reader's position in the underlying string is advanced by the number of characters the method was able to read, but the characters already read into the internal buffer are discarded. Because the position of the reader in the string cannot be changed, the characters already read are unrecoverable, and can be accessed only by reinitializing the . To avoid such a situation, use the method and store the read characters in a preallocated buffer.

  The following table lists examples of other typical or related I/O tasks.

  To do this...

  See the example in this topic...

  Create a text file.

  [<topic://cpconwritingtexttofile>]

  Write to a text file.

  [<topic://cpconwritingtexttofile>]

  Read from a text file.

  [<topic://cpconreadingtextfromfile>]

  Append text to a file.

  [<topic://cpconopeningappendingtologfile>]

  Get the size of a file.

  Get the attributes of a file.

  Set the attributes of a file.

  Determine if a file exists.

  Read from a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

  Write to a binary file.

  [<topic://cpconReadingWritingToNewlyCreatedDataFile>]

  Reads all characters from the current position to the end of the string and returns them as a single string.

  The content from the current position to the end of the underlying 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 string asynchronously and returns them as a single 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 string.

0