System.IO.StreamReader.BaseStream Property

Returns the underlying stream.

Syntax

public virtual Stream BaseStream { get; }

Value

The underlying System.IO.Stream which the current System.IO.StreamReader instance is reading.

Remarks

You use this property to access the underlying stream. The System.IO.StreamReader class buffers input from the underlying stream when you call one of the StreamReader.Read 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 StreamReader.DiscardBufferedData method; however, this method slows performance and should be called only when absolutely necessary. The System.IO.StreamReader constructors that have the detectEncodingFromByteOrderMarks parameter can change the encoding the first time you read from the System.IO.StreamReader object.

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

Requirements

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