I want to run a background task that reads input from a TextReader and processes it a line at a time. I want the background task to block until the user types some text into a field and clicks the submit button. Is there some flavour of TextReader that will block until text is available and lets you somehow add more text to the underlying source?
I thought that a StreamReader and StreamWriter pointing to the same MemoryStream might work, but it doesn't seem to. The StreamReader sees that the MemoryStream is empty at the start, and never checks again.
I realize that it would be easier to write a ProcessLine() method and call it whenever the user clicks the submit button. However, I'm trying to design a plug-in architecture, and I'd like the plug ins to look like old-fashioned console apps with an input stream and an output stream. I want the plug in's input stream to just block until the user clicks the submit button with some input text.