Open sandboxFocus

Interface IPromise

Encapsulates value that must be defined later. Promises can used to pass introduced declarations to templates as arguments when these declarations have not been introduced yet, resolving a chicken-or-egg situation. When objects of type IPromise are passed to a template, the template will automatically receive its resolved Value instead of the IPromise object. The Promise<T> class implements this interface.

Namespace: Metalama.Framework.Utilities
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IPromise

Properties

Name Description
Exception

Gets the Exception that the promise resulted in, if IsFaulted is true.

IsFaulted

Gets a value indicating whether the promise is faulted. In this case, the Exception property is set.

IsResolved

Gets a value indicating whether the Value setter has been successfully invoked.

Value

Gets the value. Throws InvalidOperationException if IsResolved is false.