C# program to shows how to use the StreamReader class with the ReadtoEnd function

Category > CSHARP || Published on : Friday, October 16, 2020 || Views: 28 || StreamReader class with the ReadtoEnd function


Here Pawan Kumar will explain how to how to use the StreamReader class with the ReadtoEnd function

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:\Hello.html");
            // Displaying all the contents of the file
            Console.WriteLine(src.ReadToEnd());
            Console.Read();
        }
    }
}