C# program to showcases the way to use the StreamReader class.

Category > CSHARP || Published on : Wednesday, October 14, 2020 || Views: 33 || StreamReader class C#


Here Pawan Kumar will explain how to showcases the way to use the StreamReader class

using System;
using System.IO;
namespace Demo
{
    class Program
    {
        // The main function
        static void Main(string[] args)
        {
            // Opening the file in read only mode
            StreamReader src = new StreamReader(@"C:\Test.html");
            // Displaying the first line of the file
            Console.WriteLine(src.ReadLine());
            Console.Read();
        }
    }
}