Created
December 15, 2013 00:00
-
-
Save shane-edmonds/7966728 to your computer and use it in GitHub Desktop.
You can use the File.ReadLines Method to read the file line-by-line without loading the whole file into memory at once, and the Parallel.ForEach Method to process the lines in multiple threads in parallel.
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
Parallel.ForEach(File.ReadLines("file.txt"), (line, _, lineNumber) => | |
{ | |
// processing code here | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment