C# Class AsyncDolls.TaskCompletionSource

Represents the producer side of a System.Threading.Tasks.Task unbound to a delegate, providing access to the consumer side through the Task property.
Mostrar archivo Open project: danielmarbach/async-dolls Class Usage Examples

Public Methods

Method Description
SetCanceled ( ) : void

Transitions the underlying Task into the TaskStatus.Canceled state.

SetException ( Exception exception ) : void

Transitions the underlying Task into the TaskStatus.Faulted state.

SetException ( IEnumerable exceptions ) : void

Transitions the underlying Task into the TaskStatus.Faulted state.

SetResult ( ) : void

Transitions the underlying Task into the TaskStatus.RanToCompletion state.

TaskCompletionSource ( ) : System

Initializes a new instance of the TaskCompletionSource class.

TaskCompletionSource ( TaskCreationOptions creationOptions ) : System

Initializes a new instance of the TaskCompletionSource class with the specified options.

TaskCompletionSource ( object state ) : System

Initializes a new instance of the TaskCompletionSource class with the specified state.

TaskCompletionSource ( object state, TaskCreationOptions creationOptions ) : System

Initializes a new instance of the TaskCompletionSource class with the specified state and options.

TrySetCanceled ( ) : bool

Attempts to transition the underlying Task into the TaskStatus.Canceled state.

TrySetException ( Exception exception ) : bool

Attempts to transition the underlying Task into the TaskStatus.Faulted state.

TrySetException ( IEnumerable exceptions ) : bool

Attempts to transition the underlying Task into the TaskStatus.Faulted state.

TrySetResult ( ) : bool

Attempts to transition the underlying Task into the TaskStatus.RanToCompletion state.

Method Details

SetCanceled() public method

Transitions the underlying Task into the TaskStatus.Canceled state.
The underlying has already been completed.
public SetCanceled ( ) : void
return void

SetException() public method

Transitions the underlying Task into the TaskStatus.Faulted state.
The underlying has already been completed.
public SetException ( Exception exception ) : void
exception System.Exception The exception to bind to this . May not be null.
return void

SetException() public method

Transitions the underlying Task into the TaskStatus.Faulted state.
The underlying has already been completed.
public SetException ( IEnumerable exceptions ) : void
exceptions IEnumerable The collection of exceptions to bind to this . May not be null or contain null elements.
return void

SetResult() public method

Transitions the underlying Task into the TaskStatus.RanToCompletion state.
The underlying has already been completed.
public SetResult ( ) : void
return void

TaskCompletionSource() public method

Initializes a new instance of the TaskCompletionSource class.
public TaskCompletionSource ( ) : System
return System

TaskCompletionSource() public method

Initializes a new instance of the TaskCompletionSource class with the specified options.
public TaskCompletionSource ( TaskCreationOptions creationOptions ) : System
creationOptions TaskCreationOptions The options to use when creating the underlying .
return System

TaskCompletionSource() public method

Initializes a new instance of the TaskCompletionSource class with the specified state.
public TaskCompletionSource ( object state ) : System
state object The state to use as the underlying 's .
return System

TaskCompletionSource() public method

Initializes a new instance of the TaskCompletionSource class with the specified state and options.
public TaskCompletionSource ( object state, TaskCreationOptions creationOptions ) : System
state object The state to use as the underlying 's .
creationOptions TaskCreationOptions The options to use when creating the underlying .
return System

TrySetCanceled() public method

Attempts to transition the underlying Task into the TaskStatus.Canceled state.
public TrySetCanceled ( ) : bool
return bool

TrySetException() public method

Attempts to transition the underlying Task into the TaskStatus.Faulted state.
public TrySetException ( Exception exception ) : bool
exception System.Exception The exception to bind to this . May not be null.
return bool

TrySetException() public method

Attempts to transition the underlying Task into the TaskStatus.Faulted state.
public TrySetException ( IEnumerable exceptions ) : bool
exceptions IEnumerable The collection of exceptions to bind to this . May not be null or contain null elements.
return bool

TrySetResult() public method

Attempts to transition the underlying Task into the TaskStatus.RanToCompletion state.
public TrySetResult ( ) : bool
return bool