C# flush redirected console output

8.5k views Asked by At

I'm using this approach to redirect the console output in C#. The problem is, it doesn't flush when I set a breakpoint in debug mode.

Sol 1, sol 2 and sol 3 are too complicated. I don't want to use the process class. Is there any simple way to flush the output in C#?

Or, since I'm using VS2013 for debugging, does anyone know if there is a flush button in VS2013 to flush the output?

1

There are 1 answers

1
Xenolightning On BEST ANSWER

Open the Immediate Window, Debug > Windows > Immediate Window.

Type in Console.Out.Flush() and hit Enter. This will invoke Flush on the output stream, on another thread, without interfering with your current breakpoint.