I understand that I cannot store my complete data in memory, so I want to transfer parts to memory and work with them, and then write them back.
The output is a very useful keyword, it saves the entire collection of counter usage and stores the index, ...
But when I want to shift IEnumerable
with yield around and write them back to the collection / file, do I need to use the enumerator concept or is there something similar like the opposite of yield? I head RX, but I donβt understand if it solves my problem?
public static IEnumerable<string> ReadFile() { string line; var reader = new System.IO.StreamReader(@"c:\\temp\\test.txt"); while ((line = reader.ReadLine()) != null) { yield return line; } reader.Close(); } public static void StreamFile() { foreach (string line in ReadFile()) { WriteFile(line); } } public static void WriteFile(string line) {
source share