Javatpoint Logo
Javatpoint Logo

C# StreamReader

C# StreamReader class is used to read string from the stream. It inherits TextReader class. It provides Read() and ReadLine() methods to read data from the stream.

C# StreamReader example to read one line

Let's see the simple example of StreamReader class that reads a single line of data from the file.

Output:

Hello C#

C# StreamReader example to read all lines

Output:

Hello C#
this is file handling
Next TopicC# TextWriter





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA