Was this page helpful?

Result<T> Class

    Table of contents
    1. 1. Generic Parameters
      1. 1.1. Parameter T
    2. 2. Members
      1. 2.1. Constructors
      2. 2.2. Fields
      3. 2.3. Properties
      4. 2.4. Methods
    Table of Contents
    public sealed class Result<T>
    Namespace: MindTouch.Tasking
    Assembly: mindtouch.dream
    Type Hierarchy:
    Implements:
    An implemenation of MindTouch.Tasking.AResult that has a value on successful completion. Use MindTouch.Tasking.Result if no return value is desired.

    Generic Parameters

    Parameter T

    Constraints:
    none

    Members

    Constructors

    Visibility Description
    Public Result() Create a new instance with the default timeout.
    Public Result(TimeSpan timeout) Create a new instance with a timeout.
    Public Result(TaskEnv env) Create a new instance with a given environment.
    Public Result(TimeSpan timeout, TaskEnv env) Create a new instance with a given environment and timeout

    Fields

    Visibility Description
    Protected _state The current state of the Result.
    Protected _env The task environment to execute the callbacks in.

    Properties

    Visibility Description
    Public ValueType (Override) Type of value that the result encapsulates (if any).
    Public UntypedValue (Override) Accessor to encapsulated value as an object, if set.
    Protected HasCleanup (Override) True if the instance has a clean-up callback.
    Public Value The value set on the result on successful completion.
    Public HasException The result has an exception set on it. (Inherited from AResult)
    Public HasValue The result has a value set on it. (Inherited from AResult)
    Public HasTimedOut The result has failed to complete because it timed out. (Inherited from AResult)
    Public IsCanceled The result will not complete because it was canceled. (Inherited from AResult)
    Public HasFinished The action using the result as a synchronization handle has completed. (Inherited from AResult)
    Public Timeout Amount of time this result will wait before it has to be signaled to succeed. (Inherited from AResult)
    Public Env The environment in which this result is being used. (Inherited from AResult)
    Public Exception The exception set on the result if AResult.HasException is True. (Inherited from AResult)
    Protected HasCompletion True if the Result has a completion callback. (Inherited from AResult)

    Methods

    Visibility Description
    Public WithCleanup(Action<Result<T>> callback) Register a clean-up callback to allow disposal of System.IDisposable resources used in invocation.
    Protected CallCleanupCanceled() (Override) Try to call the clean-up callback on result cancelation.
    Protected CallCleanupError(Exception exception) (Override) Try to call the clean-up callback on result error.
    Public Block() Block on the current thread until the result completes either successfully or with an exception.
    Public Block(AutoResetEvent signal) Block on the current thread until the result completes either successfully or with an exception.
    Public Wait() WARNING: This method is thread-blocking. Please avoid using it if possible.
    Public Wait(AutoResetEvent signal) WARNING: This method is thread-blocking. Please avoid using it if possible.
    Public WhenDone(Action<Result<T>> handler) Register a callback handler that is invoked when the result completes.
    Public WhenDone(Action<T> success, Action<Exception> error) Register a success and an error callback handler for invocation depending on result completion.
    Public Return(T value) Set successful completion on the result. Will throw System.InvalidOperationException if the result can not transition into the successful completion state.
    Public TryReturn(T value) Try to set successful completion on the result. Unlike Result<T>.Return(T value) and Result<T>.Return(Result<T> result) does not throw.
    Public Return(Result<T> result) Use another MindTouch.Tasking.Result's completion to trigger completion of this instance.
    Public Confirm() Confirm that the result does not have an exception. If it has a an exception, it will be rethrown by this call. (Inherited from AResult)
    Public Throw(Exception exception) Set an exception on the result. (Inherited from AResult)
    Public Cancel() Mark the handle as canceled, to notify the pending action that execution should be aborted. (Inherited from AResult)
    Public ConfirmCancel() Signal that the executing end has acknowledged the cancel action of the invokee. (Inherited from AResult)
    Protected EnsureFinished() Behaves as a no-op if the result has finished, otherwise throws System.InvalidProgramException. (Inherited from AResult)
    Protected SetStateError(Exception exception) Try to set the state to AResult.ResultState.Error. (Inherited from AResult)
    Protected SetStateCancel(Exception exception) Try to set the state to AResult.ResultState.Cancel. (Inherited from AResult)
    Protected SetStateConfirmCancel() Try to set the state to AResult.ResultState.ConfirmedCancel. Will throw System.InvalidOperationException if the state transition is invalid. (Inherited from AResult)
    Protected CallCompletion() Cancels any internal timer and calls the completion. (Inherited from AResult)
    Public Block() Block on the current thread until the result completes either successfully or with an exception. (Inherited from AResult)
    Public Block(AutoResetEvent signal) Block on the current thread until the result completes either successfully or with an exception. (Inherited from AResult)
    Public Wait() Block on the current thread until the result completes. Will throw if an exception triggers completion. (Inherited from AResult)
    Public Wait(AutoResetEvent signal) Block on the current thread until the result completes. Will throw if an exception triggers completion. (Inherited from AResult)
    Public WhenDone(Action<AResult> handler) Register a callback handler that is invoked when the result completes. (Inherited from AResult)
    Protected WhenDone(Action<TResult> completion) Register a callback for result completion. (Inherited from AResult)
    Public ToString() (Inherited from Object)
    Public Equals(object obj) (Inherited from Object)
    Public GetHashCode() (Inherited from Object)
    Public GetType() (Inherited from Object)
    Protected MemberwiseClone() (Inherited from Object)
    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by