Search code examples
c#streamreaderlarge-files

StreamReader Gets Stuck on Large Files


I'm trying to read a 50GB text file with a streamreader. It doesn't even get to reading the file, because my program freezes on the second line(of code, not the file).

string filename = @"C:\wikipedia\dump.xml";
StreamReader wikipediaReader = new StreamReader(filename);
string line = "";
while((line = wikipediaReader.ReadLine()) != null)
{
    Console.WriteLine(line);
    Console.ReadKey();
}

Solution

  • It could be anti-virus software trying to scan the file.