Class SynchronizationContextExtensions
Extension methods for SynchronizationContext.
Inherited Members
Namespace: UnityFx.Async.Extensions
Assembly: UnityFx.Async-netstandard2.0.dll
Syntax
public static class SynchronizationContextExtensions
Methods
| Improve this Doc View SourceInvoke(SynchronizationContext, Action)
Dispatches a message to a synchronization context.
Declaration
public static void Invoke(this SynchronizationContext context, Action action)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
Action | action | The delegate to invoke. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Invoke(SynchronizationContext, SendOrPostCallback, Object)
Dispatches a message to a synchronization context.
Declaration
public static void Invoke(this SynchronizationContext context, SendOrPostCallback d, object state)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
SendOrPostCallback | d | The delegate to invoke. |
Object | state | User-defined state. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
InvokeAsync(SynchronizationContext, Action)
Dispatches a message to a synchronization context.
Declaration
public static IAsyncOperation InvokeAsync(this SynchronizationContext context, Action action)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
Action | action | The delegate to invoke. |
Returns
Type | Description |
---|---|
IAsyncOperation | An IAsyncOperation that can be used to track the operation status. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
InvokeAsync(SynchronizationContext, SendOrPostCallback, Object)
Dispatches a message to a synchronization context.
Declaration
public static IAsyncOperation InvokeAsync(this SynchronizationContext context, SendOrPostCallback d, object state)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
SendOrPostCallback | d | The delegate to invoke. |
Object | state | User-defined state. |
Returns
Type | Description |
---|---|
IAsyncOperation | An IAsyncOperation that can be used to track the operation status. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
InvokeAsync<T>(SynchronizationContext, Func<T>)
Dispatches a message to a synchronization context.
Declaration
public static IAsyncOperation<T> InvokeAsync<T>(this SynchronizationContext context, Func<T> action)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
System.Func<T> | action | The delegate to invoke. |
Returns
Type | Description |
---|---|
IAsyncOperation<T> | An IAsyncOperation<TResult> that can be used to track the operation status. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Post(SynchronizationContext, Action)
Dispatches an asynchronous message to a synchronization context.
Declaration
public static void Post(this SynchronizationContext context, Action action)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
Action | action | The delegate to invoke. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
PostAsync(SynchronizationContext, Action)
Dispatches an asynchronous message to a synchronization context.
Declaration
public static IAsyncOperation PostAsync(this SynchronizationContext context, Action action)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
Action | action | The delegate to invoke. |
Returns
Type | Description |
---|---|
IAsyncOperation | An IAsyncOperation that can be used to track the operation status. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
PostAsync(SynchronizationContext, SendOrPostCallback, Object)
Dispatches an asynchronous message to a synchronization context.
Declaration
public static IAsyncOperation PostAsync(this SynchronizationContext context, SendOrPostCallback d, object state)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
SendOrPostCallback | d | The delegate to invoke. |
Object | state | User-defined state. |
Returns
Type | Description |
---|---|
IAsyncOperation | An IAsyncOperation that can be used to track the operation status. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
PostAsync<T>(SynchronizationContext, Func<T>)
Dispatches an asynchronous message to a synchronization context.
Declaration
public static IAsyncOperation<T> PostAsync<T>(this SynchronizationContext context, Func<T> action)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
System.Func<T> | action | The delegate to invoke. |
Returns
Type | Description |
---|---|
IAsyncOperation<T> | An IAsyncOperation<TResult> that can be used to track the operation status. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Send(SynchronizationContext, Action)
Dispatches an synchronous message to a synchronization context.
Declaration
public static void Send(this SynchronizationContext context, Action action)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
Action | action | The delegate to invoke. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Send<T>(SynchronizationContext, Func<T>)
Dispatches an synchronous message to a synchronization context.
Declaration
public static T Send<T>(this SynchronizationContext context, Func<T> action)
Parameters
Type | Name | Description |
---|---|---|
SynchronizationContext | context | The target context. |
System.Func<T> | action | The delegate to invoke. |
Returns
Type | Description |
---|---|
T | Returns result of the |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |