Mono Class Library: System.IO Namespace

System.IO.StreamReader Class

Implements a System.IO.Stream that reads characters from a byte stream in a particular encoding. [Edit]

See Also: StreamReader Members

System.Object
     System.MarshalByRefObject
          System.IO.TextReader
               System.IO.StreamReader

[System.Runtime.InteropServices.ComVisible(true)]
public class StreamReader : TextReader

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.

Remarks

The System.IO.StreamReader class is designed for character input in a particular System.Text.Encoding, whereas subclasses of System.IO.Stream are designed for byte input and output.

Note:

System.IO.StreamReader 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.

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

By default, a System.IO.StreamReader is not thread safe. For a thread-safe wrapper, see TextReader.Synchronized(TextReader) .

[Edit]

Requirements

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