title: How can I determine whether Console.Out has been redirected to a file?
body: <p>If my program is printing to the console, I perform word-wrapping in a certain way according to Console.WindowWidth by inserting newlines - and this works perfectly.</p>
  
  <p>However if the output of the program is redirected to a file or another program I would like it to skip the word-wrapping. How can I detect when this is the case?</p>
  
  <p>Console.WindowWidth returns the same number in both cases.</p>
  
  <p><strong>Bonus</strong> points if the solution can distinguish redirected Console.Out from redirected Console.Error.</p>