Wednesday, October 27, 2010

Get number of rows in file in C#

This small one line of code will give you total number of lines or rows in a normal text file in c#.

Just save result of this in normal int variable and you ready to go..

int lines = System.IO.File.ReadAllLines("path").Length

Hope this helps in File read operations

No comments:

Post a Comment