C# Read Text File Line by Line – Programming, Pseudocode Example, C# Programming Example
C# Console File

C# Read Text File Line by Line

File.ReadLines() method to read a text file that has lots of lines. File.ReadLines() method internally creates Enumerator. So we can call it in the foreach and every time foreach asks for a next value, it calls StreamReader.Re­adLine under the hood.

C# Code: You can use File.ReadLines and foreach  to read whole file line by line

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.