Class QuietTextWriter
TextWriter that does not leak exceptions
public class QuietTextWriter : TextWriterAdapter, IDisposable, IAsyncDisposable
- Inheritance
-
QuietTextWriter
- Implements
- Derived
- Inherited Members
Remarks
QuietTextWriter does not throw exceptions when things go wrong. Instead, it delegates error handling to its IErrorHandler.
Constructors
QuietTextWriter(TextWriter, IErrorHandler)
Constructor
public QuietTextWriter(TextWriter writer, IErrorHandler errorHandler)
Parameters
writerTextWriterthe writer to actually write to
errorHandlerIErrorHandlerthe error handler to report error to
Remarks
Create a new QuietTextWriter using a writer and error handler
Properties
Closed
Gets a value indicating whether this writer is closed.
public bool Closed { get; }
Property Value
- bool
trueif this writer is closed, otherwisefalse.
Remarks
Gets a value indicating whether this writer is closed.
ErrorHandler
Gets or sets the error handler that all errors are passed to.
public IErrorHandler ErrorHandler { get; set; }
Property Value
- IErrorHandler
The error handler that all errors are passed to.
Remarks
Gets or sets the error handler that all errors are passed to.
Methods
Close()
Closes the underlying output writer.
public override void Close()
Remarks
Closes the underlying output writer.
Write(char)
Writes a character to the underlying writer
public override void Write(char value)
Parameters
valuecharthe char to write
Remarks
Writes a character to the underlying writer
Write(char[], int, int)
Writes a buffer to the underlying writer
public override void Write(char[] buffer, int index, int count)
Parameters
bufferchar[]the buffer to write
indexintthe start index to write from
countintthe number of characters to write
Remarks
Writes a buffer to the underlying writer
Write(string)
Writes a string to the output.
public override void Write(string value)
Parameters
valuestringThe string data to write to the output.
Remarks
Writes a string to the output.