Stream TextReader to a File
c#, stream, textreader
Solution
using (var textReader = File.OpenText("input.txt"))
using (var writer = File.CreateText("output.txt"))
{
do
{
string line = textReader.ReadLine();
writer.WriteLine(line);
} while (!textReader.EndOfStream);
}
Problem
I have a `TextReader` object. Now, I want to stream the whole content of the `TextReader` to a File. I cannot use `ReadToEnd()` and write all to a file at once, because the content can be of high size. Can someone give me a sample/tip how to do this in Blocks?