using(StreamReader file = new StreamReader(textFile)) { int counter = 0; string ln; while ((ln = file.ReadLine()) != null) { Console.WriteLine(ln); counter++; } file.Close(); }