Interface IAsyncOperation
Represents the consumer side of an asynchronous operation (promise).
Inherited Members
Namespace: UnityFx.Async
Assembly: UnityFx.Async-netstandard2.0.dll
Syntax
public interface IAsyncOperation : IAsyncOperationCallbacks, IAsyncCancellable, IAsyncResult, IDisposable
Remarks
The interface defines a read-only consumer side of an asynchronous operation. Basically it provides the operation state information and completion/progress events. It is cancellable so a cancellation request can be issued at any time (without any guarantees though).
Properties
| Improve this Doc View SourceException
Gets an exception that caused the operation to end prematurely. If the operation completed successfully or has not yet thrown any exceptions, this will return null.
Declaration
Exception Exception { get; }
Property Value
Type | Description |
---|---|
Exception | An exception that caused the operation to end prematurely. |
Remarks
Task uses a special aggregate exception for providing generic error information. The library does not allow child operations by design and this fact makes usage of aggregate exceptions a very rare case. This is why we use Exception here.
See Also
| Improve this Doc View SourceId
Gets a unique ID for the operation instance.
Declaration
int Id { get; }
Property Value
Type | Description |
---|---|
Int32 | Unique non-zero identifier of the operation instance. |
Remarks
The identifiers might be assigned on demand and do not represent the order in which operations instances were created.
IsCanceled
Gets a value indicating whether the operation completed due to being canceled (i.e. with Canceled status).
Declaration
bool IsCanceled { get; }
Property Value
Type | Description |
---|---|
Boolean | A value indicating whether the operation was canceled. |
Remarks
If IsCanceled is true, the operation's Status will be equal to Canceled, and its Exception property will be non-null.
See Also
| Improve this Doc View SourceIsCompletedSuccessfully
Gets a value indicating whether the operation completed successfully (i.e. with RanToCompletion status).
Declaration
bool IsCompletedSuccessfully { get; }
Property Value
Type | Description |
---|---|
Boolean | A value indicating whether the operation completed successfully. |
See Also
| Improve this Doc View SourceIsFaulted
Gets a value indicating whether the operation completed due to an unhandled exception (i.e. with Faulted status).
Declaration
bool IsFaulted { get; }
Property Value
Type | Description |
---|---|
Boolean | A value indicating whether the operation has failed. |
Remarks
If IsFaulted is true, the operation's Status will be equal to Faulted, and its Exception property will be non-null.
See Also
| Improve this Doc View SourceProgress
Gets the operation progress [0, 1].
Declaration
float Progress { get; }
Property Value
Type | Description |
---|---|
Single | Progress of the operation in range [0, 1]. |
Remarks
Different operation implementations might provide different progress resolution. Users of this interface can expect 0 value until the operation is started and 1 when it is completed as minimum.
See Also
| Improve this Doc View SourceStatus
Gets the operation status identifier.
Declaration
AsyncOperationStatus Status { get; }
Property Value
Type | Description |
---|---|
AsyncOperationStatus | Identifier of the operation status. |