StreamReader.DiscardBufferedData Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Clears the internal buffer.

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

Syntax

Public Sub DiscardBufferedData
public void DiscardBufferedData()

Remarks

Use the DiscardBufferedData method to reset the internal buffer for the StreamReader object. You need to call this method only when the position of the internal buffer and the BaseStream do not match. These positions can become mismatched when you read data into the buffer and then seek a new position in the underlying stream. This method slows performance and should be used only when absolutely necessary, such as when you want to read a portion of the contents of a StreamReader object more than once.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

StreamReader Class

System.IO Namespace