c# - Check if output is redirected -
I have a console application that is written in C # that processes the data, prints the results . As long as the results are not available, less animation (/ - \ |) and progress percentage (xx%) which is constantly being updated.
Obviously, if the user redirects the output of my application, it will be printed in a text file where the output is redirected. If possible, I would like to avoid it.
So is there a way to find out that the output of my application is being redirected? I'm only showing progress indicators while walking with a specified parameter, but I hope someone has a good answer for me.
You can not redirect completely out of the output execution program and completely out of it . You can add a command line option to disable your beautiful output so that it can also be redirected.
Edit: You can (now) ... .NET 4.5 forward (see).
Comments
Post a Comment