Edit

Share via


TaskCompletionSource.TrySetResult Method

Definition

Attempts to transition the underlying Task into the RanToCompletion state.

public:
 bool TrySetResult();
public bool TrySetResult ();
member this.TrySetResult : unit -> bool
Public Function TrySetResult () As Boolean

Returns

true if the operation was successful; otherwise, false.

Remarks

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

Applies to