Skip to content

Instantly share code, notes, and snippets.

@abdulateef
Last active July 2, 2017 06:57
Show Gist options
  • Save abdulateef/acb785f23887162e73cb1cb6908a52db to your computer and use it in GitHub Desktop.
Save abdulateef/acb785f23887162e73cb1cb6908a52db to your computer and use it in GitHub Desktop.
how to count new line in a text file
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