RunicWindowResult<TResult> struct

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public readonly struct RunicWindowResult<TResult> : IEquatable<RunicWindowResult<TResult>>

Inherits or implements IEquatable.

The result of a Window opened with IRunicWindowService.OpenForResultAsync: the value its ViewModel completed it with (IRunicWindowResult.CompleteAsync), or none when the Window closed without one. The default value is none.

Type parameters

TResult

The result's type.

Constructors

RunicWindowResult

public RunicWindowResult(TResult value)

A completed result.

Parameters

value

The value.

Properties

HasValue

public bool HasValue { get; }

Whether the Window completed with a value. false when it closed without one: the user closed it, or the application did.

Value

public TResult Value { get; }

The value the Window completed with.

Exceptions

InvalidOperationException

The Window closed without a result (RunicWindowResult.HasValue is false).

Methods

Equals

public bool Equals(RunicWindowResult<TResult> other)

Inherits documentation from IEquatable.Equals.

Equals

public override bool Equals(object? obj)

Inherits documentation from Object.Equals.

GetHashCode

public override int GetHashCode()

Inherits documentation from Object.GetHashCode.

GetValueOrDefault

public TResult GetValueOrDefault(TResult fallback)

The value, or fallback when the Window closed without one.

Parameters

fallback

The value without a result.

ToString

public override string ToString()

Inherits documentation from Object.ToString.

TryGetValue

public bool TryGetValue(out TResult value)

Gets the value, if the Window completed with one.

Parameters

value

The value, or the default of TResult.

Returns

true when the Window completed with a value.

Operators

operator !=

public static bool operator !=(RunicWindowResult<TResult> left, RunicWindowResult<TResult> right)

Whether two results differ.

operator ==

public static bool operator ==(RunicWindowResult<TResult> left, RunicWindowResult<TResult> right)

Whether two results are equal.