Answer:
See explaination for program code
Step-by-step explanation:
code below
using System;
using System.IO;
namespace ReadAndDisplayFileCOnsole
{
class Program
{
static void Main(string[] args)
{
using (StreamReader reader = new StreamReader("D:\\datafile.txt"))
{
while (true)
{
string line = reader.ReadLine();
if (line == null)
{
break;
}
Console.WriteLine(line);
}
reader.Close();
Console.Read();
}
}
}
}