C# Console Out
Description
Console Out
gets the standard output stream.
Syntax
Console.Out
has the following syntax.
public static TextWriter Out { get; }
Example
The following example uses the Out property to display an array containing the names of files in the application's current directory to the standard output device.
using System;/*from w w w. j av a 2 s . co m*/
using System.IO;
public class Example
{
public static void Main()
{
StreamWriter sw = new StreamWriter(@".\Files.txt");
sw.AutoFlush = true;
Console.SetOut(sw);
Console.Out.WriteLine();
Console.Out.Close();
sw = new StreamWriter(Console.OpenStandardOutput());
sw.AutoFlush = true;
Console.SetOut(sw);
}
}