Last active
July 2, 2017 06:57
-
-
Save abdulateef/acb785f23887162e73cb1cb6908a52db to your computer and use it in GitHub Desktop.
how to count new line in a text file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int Rowcount(string filepath) | |
{ | |
int lineCount = 0; | |
using(var reader = File.OpenText(filepath)) | |
{ | |
while(reader.ReadLine() != null) | |
{ | |
lineCount++; | |
} | |
} | |
return lineCount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment