Microsoft
Software
Hardware
Network
Question : Parsing large files cause an exception
Hi,
I've to parse some very large files (up to 100MB)which cause an out of memory exception.
The way I try it now is this:
FileStream fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read,
FileShare.ReadWrite);
StreamReader sr = new StreamReader(fs);
string strResult = sr.ReadToEnd();
sr.Close();
fs.Close();
I think it will be possible to read them by line but I think for a fast parsing it will be usefull to work with them in memory.
So maybe there's an other way to work with such large files that doesn't cause an exception?
What whould you suggest?
Thanks
Andre
Answer : Parsing large files cause an exception
You can try reading chunk by chunk add them to a stringbuilder as shown in this link =>
http://stackoverflow.com/q
uestions/2
161895/rea
ding-large
-
text-file
s-with-str
eams-in-c
Random Solutions
Moving to Exchange 2010 from Exchange 2007
How many database instance that can be supported by SQL Server 2008 Standard Edition?
Counting number of days between two dates using C#
Column Name in query
Where does this code start?
PXE-E55: ProxyDHCP service did not reply to request on port 4011 Using SCCM 2007
How can i setup IIS on windows server 2008
Require 2 CPUs on an Intel Server SC5520HC Motherboard?
PHP calling URL (which domain got me here?) PATH_INFO?
Sonicwall Pro230