Struct ActivityResult<T>
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
outcomeActivityOutcome- The terminal outcome of the activity.
dialogResultKindDialogResultKind- The modal result from which the outcome was derived.
valueT- The value produced by a completed activity.
exceptionException- The exception captured from a failed activity.
Properties
DialogResultKind
The modal result kind the outcome was derived from.
public DialogResultKind DialogResultKind { get; }
Property Value
Exception
public Exception? Exception { get; }
Property Value
IsCompleted
True when the operation completed successfully.
public bool IsCompleted { get; }
Property Value
Outcome
The terminal outcome of the run.
public ActivityOutcome Outcome { get; }
Property Value
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
valueTkindDialogResultKind
Returns
Failed(Exception, DialogResultKind)
A failed result carrying
exception.public static ActivityResult<T> Failed(Exception exception, DialogResultKind kind)
Parameters
exceptionExceptionkindDialogResultKind
Returns
TryGetValue(out T?)
Returns the value via
value when completed; otherwise the default.public bool TryGetValue(out T? value)
Parameters
valueT