Interface IOutputHandler

IOutputHandler interface

Defines an interface for handling output streams by name. Implementations may write to files, memory, or other destinations.

public interface IOutputHandler

Methods

NameDescription
AddOutputStream(string, Action<Stream>)Adds a named output stream using a synchronous write action.
AddOutputStream(string, Func<Stream, Task>)Adds a named output stream using an asynchronous write action.

Remarks

For a file-based implementation, see FolderOutputHandler.

Examples

Example usage with a file-based handler:

IOutputHandler handler = new FolderOutputHandler("C:\\Output");
await handler.AddOutputStream("example.txt", async stream =>
{
    using var writer = new StreamWriter(stream);
    await writer.WriteLineAsync("Example text");
});

See Also