Table of Contents

Struct ActivityResult<T>

Namespace
ItTiger.TigerCli.Tui
Assembly
ItTiger.TigerCli.dll
The rich outcome of a TigerTui activity run: the ActivityOutcome, the exact modal DialogResultKind it was derived from, the produced Value (meaningful only when Completed), and the Exception (set only when Failed).
public readonly record struct ActivityResult<T> : IEquatable<ActivityResult<T>>

Type Parameters

T
Implements
Inherited Members

Remarks

This is a rich result in the same spirit as TigerTuiResult<T>: it is never collapsed to value-or-null. Operation failures are reported here as Failed with the captured Exception rather than being thrown.

Constructors

ActivityResult(ActivityOutcome, DialogResultKind, T?, Exception?)

Creates an activity result with its outcome, dialog result, value, and exception.
public ActivityResult(ActivityOutcome outcome, DialogResultKind dialogResultKind, T? value = default, Exception? exception = null)

Parameters

outcome ActivityOutcome
The terminal outcome of the activity.
dialogResultKind DialogResultKind
The modal result from which the outcome was derived.
value T
The value produced by a completed activity.
exception Exception
The exception captured from a failed activity.

Properties

DialogResultKind

The modal result kind the outcome was derived from.
public DialogResultKind DialogResultKind { get; }

Property Value

DialogResultKind

Exception

The captured operation exception; set only when Outcome is Failed.
public Exception? Exception { get; }

Property Value

Exception

IsCompleted

True when the operation completed successfully.
public bool IsCompleted { get; }

Property Value

bool

Outcome

The terminal outcome of the run.
public ActivityOutcome Outcome { get; }

Property Value

ActivityOutcome

Value

The produced value; only meaningful when IsCompleted is true.
public T? Value { get; }

Property Value

T

Methods

Completed(T?, DialogResultKind)

A successful result carrying value.
public static ActivityResult<T> Completed(T? value, DialogResultKind kind)

Parameters

value T
kind DialogResultKind

Returns

ActivityResult<T>

Failed(Exception, DialogResultKind)

A failed result carrying exception.
public static ActivityResult<T> Failed(Exception exception, DialogResultKind kind)

Parameters

exception Exception
kind DialogResultKind

Returns

ActivityResult<T>

TryGetValue(out T?)

Returns the value via value when completed; otherwise the default.
public bool TryGetValue(out T? value)

Parameters

value T

Returns

bool