Determine the number of lines within a text file
Seriously belated edit: If you’re using .NET 4.0 or later The File class has a new ReadLines method which lazily enumerates lines rather than greedily reading them all into an array like ReadAllLines. So now you can have both efficiency and conciseness with: var lineCount = File.ReadLines(@”C:\file.txt”).Count(); Original Answer If you’re not too bothered about … Read more