TaskCompletionSource.TrySetException 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
TrySetException(IEnumerable<Exception>)
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
參數
- exceptions
- IEnumerable<Exception>
一組例外以約束於此。Task
傳回
true若手術成功;否則,。 false
例外狀況
exceptions 是 null。
中有一個或多個null元素。exceptions
exceptions收藏是空的。
備註
若 已Task處於三個最終狀態RanToCompletion之一:、 Faulted、 或 Canceled,則此操作將返回false。
適用於
TrySetException(Exception)
public:
bool TrySetException(Exception ^ exception);
public bool TrySetException(Exception exception);
member this.TrySetException : Exception -> bool
Public Function TrySetException (exception As Exception) As Boolean
參數
傳回
true若手術成功;否則,。 false
例外狀況
exception 是 null。
備註
若 已Task處於三個最終狀態RanToCompletion之一:、 Faulted、 或 Canceled,則此操作將返回false。