Class TextCapture
The TextCapture class intercepts console output and writes it to the current execution context, if one is present on the thread. If no execution context is found, the output is written to a default destination, normally the original destination of the intercepted output.
public class TextCapture : TextWriter, IDisposable, IAsyncDisposable
- Inheritance
-
TextCapture
- Implements
- Inherited Members
Constructors
TextCapture(TextWriter)
Construct a TextCapture object
public TextCapture(TextWriter defaultWriter)
Parameters
defaultWriter
TextWriterThe default destination for non-intercepted output
Properties
Encoding
Gets the Encoding in use by this TextWriter
public override Encoding Encoding { get; }
Property Value
Methods
Write(char)
Writes a single character
public override void Write(char value)
Parameters
value
charThe char to write
Write(string?)
Writes a string
public override void Write(string? value)
Parameters
value
stringThe string to write
WriteLine(string?)
Writes a string followed by a line terminator
public override void WriteLine(string? value)
Parameters
value
stringThe string to write