Here is source code of the C# Program to Use StreamReader to Read Entire Line. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
* C# Program to Use StreamReader to Read Entire Line
public sealed class Program
public static void Main()
Stream s = new FileStream(@"c:\sri\srip.txt", FileMode.Open);
using (StreamReader sr = new StreamReader(s, Encoding.UTF8))
while ((line = sr.ReadLine()) != null)
Here is the output of the C# Program:
StreamWriter writes text files. It enables easy and efficient text output. It is best placed in a using-statement to ensure it is removed from memory when no longer needed. It provides several constructors and many methods.
Sanfoundry Global Education & Learning Series – 1000 C# Programs.