How can I redirect whatever is written to the console to be written into a string?
For your own process, Console.SetOut
and redirect it to a TextWriter built on top of a string builder or memory stream. For a launched child process, use ProcessStartInfo.RedirectStandardOutput
when launching the process.
Use Console.SetOut ();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With