Redirecting The Command-line To A Text Block
It involves inheriting from the StringWriter
class, and overwriting it’s WriteLine
function with your own code that writes the text to the text block (or any other text-capable object), rather than Windows writing it to the system console (whatever that may be).
Note that this code is suitable for passing into functions that require a System.IO.Stream
, but this does not redirect messages that are being sent directly to the command line.