CKTIS / C#
Console.Out — the standard output writer
Console.Out exposes a TextWriter representing the application's standard output. It supports direct text output and follows redirection configured through Console.SetOut.
Version: .NET 10; repository net10.0 and LangVersion=preview; feature versions require per-entry verification
Syntax
public static System.IO.TextWriter Out { get; }
Console.Out.WriteLine("Hello");Console.Out is a static property of System.Console whose value has type System.IO.TextWriter. It represents the application's standard output, not a method or a raw byte stream. It is available in .NET 10 but was not introduced in that version.
Console.Out.WriteLine("Hello") is equivalent to calling Console.WriteLine("Hello"). The property has only a get accessor: you cannot assign a replacement directly. Use Console.SetOut(...) to change the destination. Standard output does not necessarily lead to a terminal window; it can be redirected. Console.Error represents the separate standard error output.
The example temporarily directs output to a StringWriter. Both Console.Out.Write and Console.Write then write into the buffer. The finally block restores the previous writer before the captured text is printed and the buffer is disposed. Do not close or dispose the saved original: the example does not own it. A change through Console.SetOut affects the application's shared output, so do not perform it concurrently with unrelated writes.
Examples
using System;
using System.IO;
TextWriter original = Console.Out;
using var buffer = new StringWriter();
try
{
Console.SetOut(buffer);
Console.Out.Write("Hello");
Console.Write("!");
}
finally
{
Console.SetOut(original);
}
Console.Out.WriteLine(buffer.ToString());Result
Hello!
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.