StreamReader.BaseStream Property

Definition

Returns the underlying stream.

public:
 virtual property System::IO::Stream ^ BaseStream { System::IO::Stream ^ get(); };
public virtual System.IO.Stream BaseStream { get; }
member this.BaseStream : System.IO.Stream
Public Overridable ReadOnly Property BaseStream As Stream

Property Value

The underlying stream.

Remarks

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

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

Applies to

See also