Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. int counter = 0;
  2. string line;
  3.  
  4. // Read the file and display it line by line.
  5. System.IO.StreamReader file =
  6. new System.IO.StreamReader(@"c:test.txt");
  7. while((line = file.ReadLine()) != null)
  8. {
  9. System.Console.WriteLine(line);
  10. counter++;
  11. }
  12.  
  13. file.Close();
  14. System.Console.WriteLine("There were {0} lines.", counter);
  15. // Suspend the screen.
  16. System.Console.ReadLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement