System.IO.StringReader.Read Method

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

Syntax

public override int Read ()

Returns

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

Exceptions

TypeReason
ObjectDisposedExceptionThe current reader is closed.

Remarks

This method overrides the TextReader.Read method.

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

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>]

File.AppendText(string)

FileInfo.AppendText

Get the size of a file.

FileInfo.Length

Get the attributes of a file.

File.GetAttributes(string)

Set the attributes of a file.

File.SetAttributes(string, FileAttributes)

Determine if a file exists.

File.Exists(string)

Read from a binary file.

[<topic://cpconReadingWritingToNewlyCreatedDataFile>]

Write to a binary file.

[<topic://cpconReadingWritingToNewlyCreatedDataFile>]

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0