TaskCompletionSource<TResult>.TrySetResult(TResult) メソッド
定義
基になる Task<TResult> の RanToCompletion 状態への遷移を試みます。Attempts to transition the underlying Task<TResult> into the RanToCompletion state.
public:
bool TrySetResult(TResult result);
public bool TrySetResult (TResult result);
member this.TrySetResult : 'Result -> bool
Public Function TrySetResult (result As TResult) As Boolean
パラメーター
- result
- TResult
この Task<TResult> に関連付ける結果値。The result value to bind to this Task<TResult>.
戻り値
操作が正常に終了した場合は true
。それ以外の場合は false
。true
if the operation was successful; otherwise, false
.
例外
注釈
この操作では、Task<TResult> が既に3つの最終状態 (RanToCompletion、Faulted、または Canceled) のいずれかに存在する場合は false が返されます。This operation will return false if the Task<TResult> is already in one of the three final states: RanToCompletion, Faulted, or Canceled.
このメソッドは、基になる Task<TResult> が既に破棄されている場合にも false を返します。This method also returns false if the underlying Task<TResult> has already been disposed.