Search Results for

    Show / Hide Table of Contents

    Class Future<T>

    A future.

    Inheritance
    System.Object
    FutureBase<T>
    Future<T>
    PromiseBase<T>
    Inherited Members
    FutureBase<T>.State
    FutureBase<T>.Result
    FutureBase<T>.Exception
    Namespace: FM.LiveSwitch
    Assembly: FM.LiveSwitch.dll
    Syntax
    public abstract class Future<T> : FutureBase<T> where T : class
    Type Parameters
    Name Description
    T

    The type of the result.

    Methods

    Fail(Action1<Exception>)

    Appends a handler to be executed when the promise is rejected.

    Declaration
    public abstract Future<T> Fail(Action1<Exception> rejectAction)
    Parameters
    Type Name Description
    Action1<Exception> rejectAction

    The reject action.

    Returns
    Type Description
    Future<T>

    Fail(Function1<Exception, Future<T>>)

    Appends a handler to be executed when the promise is rejected.

    Declaration
    public abstract Future<T> Fail(Function1<Exception, Future<T>> rejectFunction)
    Parameters
    Type Name Description
    Function1<Exception, Future<T>> rejectFunction

    The reject function.

    Returns
    Type Description
    Future<T>

    Then(Action1<T>)

    Appends a handler to be executed when the promise is resolved.

    Declaration
    public abstract Future<T> Then(Action1<T> resolveAction)
    Parameters
    Type Name Description
    Action1<T> resolveAction

    The resolve action.

    Returns
    Type Description
    Future<T>

    Then(Action1<T>, Action1<Exception>)

    Appends handlers to be executed when the promise is resolved or rejected.

    Declaration
    public abstract Future<T> Then(Action1<T> resolveAction, Action1<Exception> rejectAction)
    Parameters
    Type Name Description
    Action1<T> resolveAction

    The resolve action.

    Action1<Exception> rejectAction

    The reject action.

    Returns
    Type Description
    Future<T>

    Then<R>(Function1<T, Future<R>>)

    Appends a handler to be executed when the promise is resolved.

    Declaration
    public abstract Future<R> Then<R>(Function1<T, Future<R>> resolveFunction)
        where R : class
    Parameters
    Type Name Description
    Function1<T, Future<R>> resolveFunction

    The resolve function.

    Returns
    Type Description
    Future<R>
    Type Parameters
    Name Description
    R

    Then<R>(Function1<T, Future<R>>, Action1<Exception>)

    Appends handlers to be executed when the promise is resolved or rejected.

    Declaration
    public abstract Future<R> Then<R>(Function1<T, Future<R>> resolveFunction, Action1<Exception> rejectAction)
        where R : class
    Parameters
    Type Name Description
    Function1<T, Future<R>> resolveFunction

    The resolve function.

    Action1<Exception> rejectAction

    The reject action.

    Returns
    Type Description
    Future<R>
    Type Parameters
    Name Description
    R

    WaitForPromise()

    Blocks the current thread from proceeding until the future state has been resolved or rejected.

    Declaration
    public void WaitForPromise()

    WaitForPromise(Int32)

    Blocks the current thread from proceeding until the future state has been resolved or rejected or if the timeout period elapses.

    Declaration
    public void WaitForPromise(int millisecondsTimeout)
    Parameters
    Type Name Description
    System.Int32 millisecondsTimeout

    The number of milliseconds to wait before timing out.

    WaitForResult()

    Blocks the current thread from proceeding until the future has a result. Throws an exception if the promise is rejected.

    Declaration
    public T WaitForResult()
    Returns
    Type Description
    T

    WaitForResult(Int32)

    Blocks the current thread from proceeding until the future has a result. Throws an exception if the promise is rejected or if the timeout period elapses.

    Declaration
    public T WaitForResult(int millisecondsTimeout)
    Parameters
    Type Name Description
    System.Int32 millisecondsTimeout

    The number of milliseconds to wait before timing out.

    Returns
    Type Description
    T

    Extension Methods

    FutureExtensions.AsTask<T>(Future<T>)
    FutureExtensions.AsTaskAsync<T>(Future<T>)
    FutureExtensions.AsTask<T>(Future<T>, TaskCreationOptions)
    FutureExtensions.GetAwaiter<T>(Future<T>)
    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.15.0