C# program to read all lines of a text file

Program

using System;

using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            int i = 0;
            string[] line;

            line = File.ReadAllLines("ABC.TXT");

            for (i = 0; i < line.Length; i++)
            {
                Console.WriteLine(line[i]);
            }
            
        }
    }
}

Output

This is Line 1.
This is Line 2.
This is Line 3.
This is Line 4.
This is Line 5.

Leave a Comment

error: Alert: Content is protected!!