Show / Hide Table of Contents

Class AsyncResult<TResult>

A lightweight net35-compatible asynchronous operation that can return a value.

Inheritance
Object
AsyncResult
AsyncResult<TResult>
AsyncCompletionSource<TResult>
Implements
IAsyncContinuation
IEnumerator
IAsyncOperation<TResult>
IAsyncOperation
IAsyncOperationCallbacks
IAsyncCancellable
IAsyncResult
IDisposable
System.IObservable<TResult>
Inherited Members
AsyncResult.ProgressChanged
AsyncResult.Completed
AsyncResult.AddCompletionCallback(Object, SynchronizationContext)
AsyncResult.AddProgressCallback(Object, SynchronizationContext)
AsyncResult.RemoveCallback(Object)
AsyncResult.DefaultSynchronizationContext
AsyncResult.CreationOptions
AsyncResult.IsStarted
AsyncResult.IsRunning
AsyncResult.IsDisposed
AsyncResult.IsCancellationRequested
AsyncResult.Start()
AsyncResult.TryStart()
AsyncResult.TrySetScheduled()
AsyncResult.TrySetRunning()
AsyncResult.TrySetCanceled()
AsyncResult.TrySetCanceled(Boolean)
AsyncResult.TrySetException(String)
AsyncResult.TrySetException(String, Boolean)
AsyncResult.TrySetException(Exception)
AsyncResult.TrySetException(Exception, Boolean)
AsyncResult.TrySetCompleted()
AsyncResult.TrySetCompleted(Boolean)
AsyncResult.TryReportProgress()
AsyncResult.ThrowIfNonSuccess()
AsyncResult.ThrowIfDisposed()
AsyncResult.GetNewId()
AsyncResult.GetProgress()
AsyncResult.OnProgressChanged()
AsyncResult.OnStatusChanged(AsyncOperationStatus)
AsyncResult.OnStarted()
AsyncResult.OnCancel()
AsyncResult.OnCompleted()
AsyncResult.Dispose(Boolean)
AsyncResult.Id
AsyncResult.Progress
AsyncResult.Status
AsyncResult.Exception
AsyncResult.IsCompletedSuccessfully
AsyncResult.IsFaulted
AsyncResult.IsCanceled
AsyncResult.Invoke(IAsyncOperation)
AsyncResult.Cancel()
AsyncResult.AsyncWaitHandle
AsyncResult.AsyncState
AsyncResult.CompletedSynchronously
AsyncResult.IsCompleted
AsyncResult.IEnumerator.Current
AsyncResult.IEnumerator.MoveNext()
AsyncResult.IEnumerator.Reset()
AsyncResult.Dispose()
AsyncResult.CompletedOperation
AsyncResult.FaultedOperation
AsyncResult.CanceledOperation
AsyncResult.Yield()
AsyncResult.FromCanceled()
AsyncResult.FromCanceled(Object)
AsyncResult.FromCanceled<T>()
AsyncResult.FromCanceled<T>(Object)
AsyncResult.FromException(String)
AsyncResult.FromException(String, Object)
AsyncResult.FromException(Exception)
AsyncResult.FromException(Exception, Object)
AsyncResult.FromException<T>(String)
AsyncResult.FromException<T>(String, Object)
AsyncResult.FromException<T>(Exception)
AsyncResult.FromException<T>(Exception, Object)
AsyncResult.FromResult<T>(T)
AsyncResult.FromResult<T>(T, Object)
AsyncResult.FromAction(Action)
AsyncResult.FromAction<T>(Action<T>, T)
AsyncResult.FromAction(SendOrPostCallback, Object)
AsyncResult.FromAction(Delegate, Object[])
AsyncResult.FromAction<TResult>(Func<TResult>)
AsyncResult.FromAction<T, TResult>(Func<T, TResult>, T)
AsyncResult.FromTask(Task)
AsyncResult.FromTask<T>(Task<T>)
AsyncResult.FromAction(Action, CancellationToken)
AsyncResult.FromAction<TResult>(Func<TResult>, CancellationToken)
AsyncResult.FromObservable<T>(IObservable<T>)
AsyncResult.Delay(Int32)
AsyncResult.Delay(Int32, IAsyncUpdateSource)
AsyncResult.Delay(Single)
AsyncResult.Delay(Single, IAsyncUpdateSource)
AsyncResult.Delay(TimeSpan)
AsyncResult.Delay(TimeSpan, IAsyncUpdateSource)
AsyncResult.Retry(Func<IAsyncOperation>, Int32)
AsyncResult.Retry(Func<IAsyncOperation>, Int32, IAsyncUpdateSource)
AsyncResult.Retry(Func<IAsyncOperation>, Int32, Int32)
AsyncResult.Retry(Func<IAsyncOperation>, Int32, Int32, IAsyncUpdateSource)
AsyncResult.Retry(Func<IAsyncOperation>, TimeSpan)
AsyncResult.Retry(Func<IAsyncOperation>, TimeSpan, IAsyncUpdateSource)
AsyncResult.Retry(Func<IAsyncOperation>, TimeSpan, Int32)
AsyncResult.Retry(Func<IAsyncOperation>, TimeSpan, Int32, IAsyncUpdateSource)
AsyncResult.Retry<TResult>(Func<IAsyncOperation<TResult>>, Int32)
AsyncResult.Retry<TResult>(Func<IAsyncOperation<TResult>>, Int32, IAsyncUpdateSource)
AsyncResult.Retry<TResult>(Func<IAsyncOperation<TResult>>, Int32, Int32)
AsyncResult.Retry<TResult>(Func<IAsyncOperation<TResult>>, Int32, Int32, IAsyncUpdateSource)
AsyncResult.Retry<TResult>(Func<IAsyncOperation<TResult>>, TimeSpan)
AsyncResult.Retry<TResult>(Func<IAsyncOperation<TResult>>, TimeSpan, IAsyncUpdateSource)
AsyncResult.Retry<TResult>(Func<IAsyncOperation<TResult>>, TimeSpan, Int32)
AsyncResult.Retry<TResult>(Func<IAsyncOperation<TResult>>, TimeSpan, Int32, IAsyncUpdateSource)
AsyncResult.WhenAll(IEnumerable<IAsyncOperation>)
AsyncResult.WhenAll<T>(IEnumerable<IAsyncOperation<T>>)
AsyncResult.WhenAll(IAsyncOperation[])
AsyncResult.WhenAll<T>(IAsyncOperation<T>[])
AsyncResult.WhenAny<T>(IEnumerable<T>)
AsyncResult.WhenAny<T>(T[])
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: UnityFx.Async
Assembly: UnityFx.Async-netstandard2.0.dll
Syntax
public class AsyncResult<TResult> : AsyncResult, IAsyncContinuation, IEnumerator, IAsyncOperation<TResult>, IAsyncOperation, IAsyncOperationCallbacks, IAsyncCancellable, IAsyncResult, IDisposable, IObservable<TResult>
Type Parameters
Name Description
TResult

Type of the operation result value.

Constructors

| Improve this Doc View Source

AsyncResult()

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult()
| Improve this Doc View Source

AsyncResult(AsyncCallback, Object)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncCallback asyncCallback, object asyncState)
Parameters
Type Name Description
AsyncCallback asyncCallback

User-defined completion callback.

Object asyncState

User-defined data to assosiate with the operation.

| Improve this Doc View Source

AsyncResult(AsyncCreationOptions)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncCreationOptions options)
Parameters
Type Name Description
AsyncCreationOptions options

The AsyncCreationOptions used to customize the operation's behavior.

| Improve this Doc View Source

AsyncResult(AsyncCreationOptions, AsyncCallback, Object)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncCreationOptions options, AsyncCallback asyncCallback, object asyncState)
Parameters
Type Name Description
AsyncCreationOptions options

The AsyncCreationOptions used to customize the operation's behavior.

AsyncCallback asyncCallback

User-defined completion callback.

Object asyncState

User-defined data to assosiate with the operation.

| Improve this Doc View Source

AsyncResult(AsyncCreationOptions, Object)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncCreationOptions options, object asyncState)
Parameters
Type Name Description
AsyncCreationOptions options

The AsyncCreationOptions used to customize the operation's behavior.

Object asyncState

User-defined data to assosiate with the operation.

| Improve this Doc View Source

AsyncResult(AsyncOperationStatus)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncOperationStatus status)
Parameters
Type Name Description
AsyncOperationStatus status

Status value of the operation.

| Improve this Doc View Source

AsyncResult(AsyncOperationStatus, AsyncCallback, Object)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncOperationStatus status, AsyncCallback asyncCallback, object asyncState)
Parameters
Type Name Description
AsyncOperationStatus status

Status value of the operation.

AsyncCallback asyncCallback

User-defined completion callback.

Object asyncState

User-defined data to assosiate with the operation.

| Improve this Doc View Source

AsyncResult(AsyncOperationStatus, Object)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncOperationStatus status, object asyncState)
Parameters
Type Name Description
AsyncOperationStatus status

Status value of the operation.

Object asyncState

User-defined data to assosiate with the operation.

| Improve this Doc View Source

AsyncResult(AsyncOperationStatus, AsyncCreationOptions)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncOperationStatus status, AsyncCreationOptions options)
Parameters
Type Name Description
AsyncOperationStatus status

Status value of the operation.

AsyncCreationOptions options

The AsyncCreationOptions used to customize the operation's behavior.

| Improve this Doc View Source

AsyncResult(AsyncOperationStatus, AsyncCreationOptions, AsyncCallback, Object)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncOperationStatus status, AsyncCreationOptions options, AsyncCallback asyncCallback, object asyncState)
Parameters
Type Name Description
AsyncOperationStatus status

Status value of the operation.

AsyncCreationOptions options

The AsyncCreationOptions used to customize the operation's behavior.

AsyncCallback asyncCallback

User-defined completion callback.

Object asyncState

User-defined data to assosiate with the operation.

| Improve this Doc View Source

AsyncResult(AsyncOperationStatus, AsyncCreationOptions, Object)

Initializes a new instance of the AsyncResult<TResult> class.

Declaration
public AsyncResult(AsyncOperationStatus status, AsyncCreationOptions options, object asyncState)
Parameters
Type Name Description
AsyncOperationStatus status

Status value of the operation.

AsyncCreationOptions options

The AsyncCreationOptions used to customize the operation's behavior.

Object asyncState

User-defined data to assosiate with the operation.

Properties

| Improve this Doc View Source

Result

Gets the operation result value.

Declaration
public TResult Result { get; }
Property Value
Type Description
TResult

Result of the operation.

Exceptions
Type Condition
InvalidOperationException

Thrown if the property is accessed before operation is completed.

Methods

| Improve this Doc View Source

Subscribe(IObserver<TResult>)

Notifies the provider that an observer is to receive notifications.

Declaration
public IDisposable Subscribe(IObserver<TResult> observer)
Parameters
Type Name Description
System.IObserver<TResult> observer

The object that is to receive notifications.

Returns
Type Description
IDisposable

A reference to an interface that allows observers to stop receiving notifications before the provider has finished sending them.

| Improve this Doc View Source

TrySetResult(TResult)

Attempts to transition the operation into the RanToCompletion state.

Declaration
protected bool TrySetResult(TResult result)
Parameters
Type Name Description
TResult result

The operation result.

Returns
Type Description
Boolean

Returns true if the attemp was successfull; false otherwise.

Exceptions
Type Condition
ObjectDisposedException

Thrown is the operation is disposed.

See Also
TrySetResult(TResult, Boolean)
| Improve this Doc View Source

TrySetResult(TResult, Boolean)

Attempts to transition the operation into the RanToCompletion state.

Declaration
protected bool TrySetResult(TResult result, bool completedSynchronously)
Parameters
Type Name Description
TResult result

The operation result.

Boolean completedSynchronously

Value of the CompletedSynchronously property.

Returns
Type Description
Boolean

Returns true if the attemp was successfull; false otherwise.

Exceptions
Type Condition
ObjectDisposedException

Thrown is the operation is disposed.

See Also
TrySetResult(TResult)

Implements

IAsyncContinuation
System.Collections.IEnumerator
IAsyncOperation<TResult>
IAsyncOperation
IAsyncOperationCallbacks
IAsyncCancellable
System.IAsyncResult
System.IDisposable
System.IObservable<T>

Extension Methods

AsyncExtensions.ThrowIfNonSuccess(IAsyncOperation)
AsyncExtensions.WithCancellation(IAsyncOperation, CancellationToken)
AsyncExtensions.Wait(IAsyncOperation)
AsyncExtensions.Wait(IAsyncOperation, Int32)
AsyncExtensions.Wait(IAsyncOperation, TimeSpan)
AsyncExtensions.Wait(IAsyncOperation, CancellationToken)
AsyncExtensions.Wait(IAsyncOperation, Int32, CancellationToken)
AsyncExtensions.Wait(IAsyncOperation, TimeSpan, CancellationToken)
AsyncExtensions.Join(IAsyncOperation)
AsyncExtensions.Join(IAsyncOperation, Int32)
AsyncExtensions.Join(IAsyncOperation, TimeSpan)
AsyncExtensions.Join<TResult>(IAsyncOperation<TResult>)
AsyncExtensions.Join<TResult>(IAsyncOperation<TResult>, Int32)
AsyncExtensions.Join<TResult>(IAsyncOperation<TResult>, TimeSpan)
AsyncExtensions.Join(IAsyncOperation, CancellationToken)
AsyncExtensions.Join(IAsyncOperation, Int32, CancellationToken)
AsyncExtensions.Join(IAsyncOperation, TimeSpan, CancellationToken)
AsyncExtensions.Join<TResult>(IAsyncOperation<TResult>, CancellationToken)
AsyncExtensions.Join<TResult>(IAsyncOperation<TResult>, Int32, CancellationToken)
AsyncExtensions.Join<TResult>(IAsyncOperation<TResult>, TimeSpan, CancellationToken)
AsyncExtensions.ContinueWith(IAsyncOperation, Action<IAsyncOperation>)
AsyncExtensions.ContinueWith(IAsyncOperation, Action<IAsyncOperation>, AsyncContinuationOptions)
AsyncExtensions.ContinueWith(IAsyncOperation, Action<IAsyncOperation, Object>, Object)
AsyncExtensions.ContinueWith(IAsyncOperation, Action<IAsyncOperation, Object>, Object, AsyncContinuationOptions)
AsyncExtensions.ContinueWith<TResult>(IAsyncOperation, Func<IAsyncOperation, TResult>)
AsyncExtensions.ContinueWith<TResult>(IAsyncOperation, Func<IAsyncOperation, TResult>, AsyncContinuationOptions)
AsyncExtensions.ContinueWith<TResult>(IAsyncOperation, Func<IAsyncOperation, Object, TResult>, Object)
AsyncExtensions.ContinueWith<TResult>(IAsyncOperation, Func<IAsyncOperation, Object, TResult>, Object, AsyncContinuationOptions)
AsyncExtensions.ContinueWith<TResult>(IAsyncOperation<TResult>, Action<IAsyncOperation<TResult>>)
AsyncExtensions.ContinueWith<TResult>(IAsyncOperation<TResult>, Action<IAsyncOperation<TResult>>, AsyncContinuationOptions)
AsyncExtensions.ContinueWith<TResult>(IAsyncOperation<TResult>, Action<IAsyncOperation<TResult>, Object>, Object)
AsyncExtensions.ContinueWith<TResult>(IAsyncOperation<TResult>, Action<IAsyncOperation<TResult>, Object>, Object, AsyncContinuationOptions)
AsyncExtensions.ContinueWith<TResult, TNewResult>(IAsyncOperation<TResult>, Func<IAsyncOperation<TResult>, TNewResult>)
AsyncExtensions.ContinueWith<TResult, TNewResult>(IAsyncOperation<TResult>, Func<IAsyncOperation<TResult>, TNewResult>, AsyncContinuationOptions)
AsyncExtensions.ContinueWith<TResult, TNewResult>(IAsyncOperation<TResult>, Func<IAsyncOperation<TResult>, Object, TNewResult>, Object)
AsyncExtensions.ContinueWith<TResult, TNewResult>(IAsyncOperation<TResult>, Func<IAsyncOperation<TResult>, Object, TNewResult>, Object, AsyncContinuationOptions)
AsyncExtensions.ToTask(IAsyncOperation)
AsyncExtensions.ToTask<TResult>(IAsyncOperation<TResult>)
AsyncExtensions.GetAwaiter(IAsyncOperation)
AsyncExtensions.GetAwaiter<TResult>(IAsyncOperation<TResult>)
AsyncExtensions.ConfigureAwait(IAsyncOperation, Boolean)
AsyncExtensions.ConfigureAwait<TResult>(IAsyncOperation<TResult>, Boolean)
AsyncExtensions.ConfigureAwait(IAsyncOperation, AsyncCallbackOptions)
AsyncExtensions.ConfigureAwait<TResult>(IAsyncOperation<TResult>, AsyncCallbackOptions)
AsyncExtensions.AddCompletionCallback(IAsyncOperationCallbacks, Action)
AsyncExtensions.AddCompletionCallback(IAsyncOperationCallbacks, Action, AsyncCallbackOptions)
AsyncExtensions.AddCompletionCallback(IAsyncOperationCallbacks, Action<IAsyncOperation>)
AsyncExtensions.AddCompletionCallback(IAsyncOperationCallbacks, Action<IAsyncOperation>, AsyncCallbackOptions)
AsyncExtensions.AddCompletionCallback(IAsyncOperationCallbacks, IAsyncContinuation)
AsyncExtensions.AddCompletionCallback(IAsyncOperationCallbacks, IAsyncContinuation, AsyncCallbackOptions)
AsyncExtensions.AddProgressCallback(IAsyncOperationCallbacks, Action<Single>)
AsyncExtensions.AddProgressCallback(IAsyncOperationCallbacks, Action<Single>, AsyncCallbackOptions)
AsyncExtensions.AddProgressCallback(IAsyncOperationCallbacks, IProgress<Single>)
AsyncExtensions.AddProgressCallback(IAsyncOperationCallbacks, IProgress<Single>, AsyncCallbackOptions)
IAsyncResultExtensions.ToEnum(IAsyncResult)
IAsyncResultExtensions.SpinUntilCompleted(IAsyncResult)
IAsyncResultExtensions.SpinUntilCompleted(IAsyncResult, Int32)
IAsyncResultExtensions.SpinUntilCompleted(IAsyncResult, TimeSpan)
IAsyncResultExtensions.SpinUntilCompleted(IAsyncResult, CancellationToken)
IAsyncResultExtensions.SpinUntilCompleted(IAsyncResult, Int32, CancellationToken)
IAsyncResultExtensions.SpinUntilCompleted(IAsyncResult, TimeSpan, CancellationToken)
IObservableExtensions.ToAsync<T>(IObservable<T>)
PromiseExtensions.Then(IAsyncOperation, Action)
PromiseExtensions.Then<TResult>(IAsyncOperation<TResult>, Action<TResult>)
PromiseExtensions.Then(IAsyncOperation, Func<IAsyncOperation>)
PromiseExtensions.Then<TResult>(IAsyncOperation<TResult>, Func<TResult, IAsyncOperation>)
PromiseExtensions.Then<TResult>(IAsyncOperation, Func<IAsyncOperation<TResult>>)
PromiseExtensions.Then<TResult, TNewResult>(IAsyncOperation<TResult>, Func<TResult, IAsyncOperation<TNewResult>>)
PromiseExtensions.Then(IAsyncOperation, Action, Action<Exception>)
PromiseExtensions.Then<TResult>(IAsyncOperation<TResult>, Action<TResult>, Action<Exception>)
PromiseExtensions.Then(IAsyncOperation, Func<IAsyncOperation>, Action<Exception>)
PromiseExtensions.Then<TResult>(IAsyncOperation<TResult>, Func<TResult, IAsyncOperation>, Action<Exception>)
PromiseExtensions.ThenAll(IAsyncOperation, Func<IEnumerable<IAsyncOperation>>)
PromiseExtensions.ThenAll<T>(IAsyncOperation<T>, Func<T, IEnumerable<IAsyncOperation>>)
PromiseExtensions.ThenAll<T>(IAsyncOperation, Func<IEnumerable<IAsyncOperation<T>>>)
PromiseExtensions.ThenAll<T, U>(IAsyncOperation<T>, Func<T, IEnumerable<IAsyncOperation<U>>>)
PromiseExtensions.ThenAny(IAsyncOperation, Func<IEnumerable<IAsyncOperation>>)
PromiseExtensions.ThenAny<TResult>(IAsyncOperation<TResult>, Func<TResult, IEnumerable<IAsyncOperation>>)
PromiseExtensions.ThenAny<TResult>(IAsyncOperation, Func<IEnumerable<IAsyncOperation<TResult>>>)
PromiseExtensions.ThenAny<T, TResult>(IAsyncOperation<T>, Func<T, IEnumerable<IAsyncOperation<TResult>>>)
PromiseExtensions.ThenSequence(IAsyncOperation, Func<IEnumerable<Func<IAsyncOperation>>>)
PromiseExtensions.ThenSequence<TResult>(IAsyncOperation<TResult>, Func<IEnumerable<Func<IAsyncOperation>>>)
PromiseExtensions.ThenSequence(IAsyncOperation, Func<Func<IAsyncOperation>[]>)
PromiseExtensions.ThenSequence<TResult>(IAsyncOperation<TResult>, Func<Func<IAsyncOperation>[]>)
PromiseExtensions.Rebind<TResult>(IAsyncOperation, Func<TResult>)
PromiseExtensions.Rebind<TResult, TNewResult>(IAsyncOperation<TResult>, Func<TResult, TNewResult>)
PromiseExtensions.Catch(IAsyncOperation, Action<Exception>)
PromiseExtensions.Catch<TException>(IAsyncOperation, Action<TException>)
PromiseExtensions.Finally(IAsyncOperation, Action)
PromiseExtensions.Done(IAsyncOperation, Action)
PromiseExtensions.Done(IAsyncOperation, Action, Action<Exception>)
PromiseExtensions.Done<TResult>(IAsyncOperation<TResult>, Action<TResult>)
PromiseExtensions.Done<TResult>(IAsyncOperation<TResult>, Action<TResult>, Action<Exception>)
PromiseExtensions.Done(IAsyncOperation)

See Also

AsyncCompletionSource<TResult>
AsyncResult
  • Improve this Doc
  • View Source
Back to top Copyright (c) 2017-2018 Alexander Bogarsukov