Class IAsyncResultExtensions
Extension methods for IAsyncResult.
Inherited Members
Namespace: UnityFx.Async.Extensions
Assembly: UnityFx.Async-netstandard2.0.dll
Syntax
public static class IAsyncResultExtensions
Methods
| Improve this Doc View SourceSpinUntilCompleted(IAsyncResult)
Spins until the operation has completed.
Declaration
public static void SpinUntilCompleted(this IAsyncResult op)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | op | The operation to wait for. |
SpinUntilCompleted(IAsyncResult, Int32)
Spins until the operation has completed within a specified timeout.
Declaration
public static bool SpinUntilCompleted(this IAsyncResult op, int millisecondsTimeout)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | op | The operation to wait for. |
Int32 | millisecondsTimeout | The number of milliseconds to wait, or Infinite (-1) to wait indefinitely. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the operation was completed within the specified time interfval; false otherwise. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
SpinUntilCompleted(IAsyncResult, Int32, CancellationToken)
Spins until the operation has completed within a specified timeout or until canceled.
Declaration
public static bool SpinUntilCompleted(this IAsyncResult op, int millisecondsTimeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | op | The operation to wait for. |
Int32 | millisecondsTimeout | The number of milliseconds to wait, or Infinite (-1) to wait indefinitely. |
CancellationToken | cancellationToken | A cancellation token that can be used to cancel wait operation. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the operation was completed within the specified time interfval; false otherwise. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
OperationCanceledException | The |
SpinUntilCompleted(IAsyncResult, CancellationToken)
Spins until the operation has completed or until canceled.
Declaration
public static void SpinUntilCompleted(this IAsyncResult op, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | op | The operation to wait for. |
CancellationToken | cancellationToken | A cancellation token that can be used to cancel wait operation. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The |
See Also
| Improve this Doc View SourceSpinUntilCompleted(IAsyncResult, TimeSpan)
Spins until the operation has completed within a specified timeout.
Declaration
public static bool SpinUntilCompleted(this IAsyncResult op, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | op | The operation to wait for. |
TimeSpan | timeout | A TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the operation was completed within the specified time interfval; false otherwise. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
SpinUntilCompleted(IAsyncResult, TimeSpan, CancellationToken)
Spins until the operation has completed within a specified timeout or until canceled.
Declaration
public static bool SpinUntilCompleted(this IAsyncResult op, TimeSpan timeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | op | The operation to wait for. |
TimeSpan | timeout | A TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely. |
CancellationToken | cancellationToken | A cancellation token that can be used to cancel wait operation. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the operation was completed within the specified time interfval; false otherwise. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
OperationCanceledException | The |
ToEnum(IAsyncResult)
Creates an IEnumerator that completes when the specified operation completes.
Declaration
public static IEnumerator ToEnum(this IAsyncResult op)
Parameters
Type | Name | Description |
---|---|---|
IAsyncResult | op | The operation to convert to enumerator. |
Returns
Type | Description |
---|---|
IEnumerator | An enumerator that represents the operation. |