Created
April 17, 2018 18:10
-
-
Save hunterwei/94a3c704c79c24867da2d05191ab4626 to your computer and use it in GitHub Desktop.
Read Extremely large file efficiently in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) | |
using (BufferedStream bs = new BufferedStream(fs)) | |
using (StreamReader sr = new StreamReader(bs)) | |
{ | |
string line; | |
while ((line = sr.ReadLine()) != null) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment