C# program to read text from a file

Program

using System;

//We need to include this namespace for file handling.
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            string s;

            s =File.ReadAllText("ABC.TXT");

            Console.WriteLine("Content of file :\n"+s);
        }
    }
}

Output

Content of file :
Hello , This is a sample program for writing text into file.

Leave a Comment

error: Alert: Content is protected!!