Επεξεργασία

Κοινή χρήση μέσω


TaskCompletionSource.TrySetException Method

Definition

Overloads

TrySetException(IEnumerable<Exception>)

Attempts to transition the underlying Task into the Faulted state.

TrySetException(Exception)

Attempts to transition the underlying Task into the Faulted state.

TrySetException(IEnumerable<Exception>)

Source:
TaskCompletionSource.cs
Source:
TaskCompletionSource.cs
Source:
TaskCompletionSource.cs

Attempts to transition the underlying Task into the Faulted state.

public:
 bool TrySetException(System::Collections::Generic::IEnumerable<Exception ^> ^ exceptions);
public bool TrySetException (System.Collections.Generic.IEnumerable<Exception> exceptions);
member this.TrySetException : seq<Exception> -> bool
Public Function TrySetException (exceptions As IEnumerable(Of Exception)) As Boolean

Parameters

exceptions
IEnumerable<Exception>

The collection of exceptions to bind to this Task.

Returns

true if the operation was successful; otherwise, false.

Exceptions

exceptions is null.

There are one or more null elements in exceptions.

The exceptions collection is empty.

Remarks

This operation will return false if the Task is already in one of the three final states: RanToCompletion, Faulted, or Canceled.

Applies to

TrySetException(Exception)

Source:
TaskCompletionSource.cs
Source:
TaskCompletionSource.cs
Source:
TaskCompletionSource.cs

Attempts to transition the underlying Task into the Faulted state.

public:
 bool TrySetException(Exception ^ exception);
public bool TrySetException (Exception exception);
member this.TrySetException : Exception -> bool
Public Function TrySetException (exception As Exception) As Boolean

Parameters

exception
Exception

The exception to bind to this Task.

Returns

true if the operation was successful; otherwise, false.

Exceptions

exception is null.

Remarks

This operation will return false if the Task is already in one of the three final states: RanToCompletion, Faulted, or Canceled.

Applies to