Home » C# StreamReader

C# StreamReader

by Online Tutorials Library

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

You may also like