PROPERTY

Console.IsOutputRedirected

Reports whether standard output is redirected rather than attached to the console. Use it when selecting an output presentation; do not assume that false guarantees a particular terminal capability.

Formal Syntax & Structure

csharp syntaxcsharp
Console.IsOutputRedirected

Working Example

Example Snippetcsharp
using System;Console.WriteLine(Console.IsOutputRedirected); // Environment-dependent
C# & .NET Reference