Table of Contents

Class Runnable<TResult>

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

Base implementation of IRunnable<TResult> for views that can be run as blocking sessions.

public class Runnable<TResult> : Runnable, IDisposable, ISupportInitializeNotification, ISupportInitialize, IRunnable<TResult>, IRunnable

Type Parameters

TResult

The type of result data returned when the session completes.

Important: Use nullable types (e.g., Color?, int?, string?) so that null can indicate cancellation. Using non-nullable value types (e.g., Color, int) will return their default values on cancellation, making it impossible to distinguish cancellation from a valid result.

Inheritance
Runnable<TResult>
Implements
IRunnable<TResult>
Derived
Inherited Members
Extension Methods

Remarks

Views can derive from this class or implement IRunnable<TResult> directly.

This class provides default implementations of the IRunnable<TResult> interface following the Terminal.Gui Cancellable Work Pattern (CWP).

For views that don't need to return a result, use Runnable instead.

This class inherits from Runnable to avoid code duplication and ensure consistent behavior.

Constructors

Runnable()

Constructs a new instance of the Runnable<TResult> class.

Properties

Result

Gets or sets the result data extracted when the session was accepted, or null if not accepted.

Methods

OnIsRunningChanging(bool, bool)

Override to handle state changes when starting or stopping. Called by base RaiseIsRunningChanging(bool, bool) before events are raised.