First of all, it is not clear that two streams will be useful here. One thread reading one line at a time (which is pretty easy withStreamReader) , , . , , , , , . ( , , , , 1 .) , , , , . , .
, , , ...
BlockingCollection<string> . ( , .NET 4 . ... .NET 4 - .) :
string nextLine = myFileReader.ReadLine();
myBlockingCollection.Add(nextLine);
- :
while (true)
{
string lineToProcess = myBlockingCollection.Take();
ProcessLine(lineToProcess);
}
, , . Take , .
, , , - , . - . BlockingCollection<T> BoundedCapacity - , Add , , ' t, .
, , , . , , , .
, , , ( ), BlockingCollection<T> , . , , , , , , , , , , .