static void Main(string[] args) 
{
    string TheDataFile = "";
    string ErrorMsg = "";
    string lngTransDate = "";
    ProcessDataFile  ProcessTheDataFile = new ProcessDataFile();
    string TheFile = "S:\\MIS\\Provider NPI file\\Processed\\npidata_20050523-20161009.csv";
    string[] lines = File.ReadAllLines(TheFile, Encoding.UTF8);//Read all lines to an array 
    Console.WriteLine(lines.Length.ToString());
    Console.ReadLine();
}
This throws an error because the file is very large (has 6 million lines). Is there a way to handle large files and count the # of lines?
 
     
     
     
    