Share via


StreamReader.BaseStream Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Updated: December 2010

When it is called by trusted applications, returns the underlying stream.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overridable ReadOnly Property BaseStream As Stream
public virtual Stream BaseStream { get; }

Property Value

Type: System.IO.Stream
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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Change History

Date

History

Reason

December 2010

Added information about calling DiscardBufferedData.

Information enhancement.