C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

SetCanceled() публичный Метод

Transitions the underlying Task into the TaskStatus.Canceled state.
The underlying has already been completed.
public SetCanceled ( ) : void
Результат void

SetException() публичный Метод

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.
Результат void

SetException() публичный Метод

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.
Результат void

SetResult() публичный Метод

Transitions the underlying Task into the TaskStatus.RanToCompletion state.
The underlying has already been completed.
public SetResult ( ) : void
Результат void

TaskCompletionSource() публичный Метод

Initializes a new instance of the TaskCompletionSource class.
public TaskCompletionSource ( ) : System
Результат System

TaskCompletionSource() публичный Метод

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 .
Результат System

TaskCompletionSource() публичный Метод

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 .
Результат System

TaskCompletionSource() публичный Метод

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 .
Результат System

TrySetCanceled() публичный Метод

Attempts to transition the underlying Task into the TaskStatus.Canceled state.
public TrySetCanceled ( ) : bool
Результат bool

TrySetException() публичный Метод

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.
Результат bool

TrySetException() публичный Метод

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.
Результат bool

TrySetResult() публичный Метод

Attempts to transition the underlying Task into the TaskStatus.RanToCompletion state.
public TrySetResult ( ) : bool
Результат bool