H
haibhoang
I have a Windows Service that is trying to parse a large (> 1Gig) text
file. I am keep getting OutOfMemoryException exception. Here is the
code that's having problem:
using (StreamReader streamReader = new
StreamReader(stream, Encoding.ASCII))
{
string line = "";
DateTime currentDate = DateTime.Now.Date;
while (streamReader.Peek() > -1)
{
line = streamReader.ReadLine();
}
}
I read the documentation and realized that the ReadLine() method is not
every efficient. Is there another way that I can do this?
Thanks,
Hai
file. I am keep getting OutOfMemoryException exception. Here is the
code that's having problem:
using (StreamReader streamReader = new
StreamReader(stream, Encoding.ASCII))
{
string line = "";
DateTime currentDate = DateTime.Now.Date;
while (streamReader.Peek() > -1)
{
line = streamReader.ReadLine();
}
}
I read the documentation and realized that the ReadLine() method is not
every efficient. Is there another way that I can do this?
Thanks,
Hai