TaskCompletionSource.TrySetException 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| TrySetException(IEnumerable<Exception>) | |
| TrySetException(Exception) |
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。
exceptions 中有一或多個 null 項目。
exceptions 集合是空的。
備註
如果 已經處於三個最終狀態之一,則此作業會傳回 false : RanToCompletion 、 Faulted 或 Canceled 。 Task
適用於
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。
備註
如果 已經處於三個最終狀態之一,則此作業會傳回 false : RanToCompletion 、 Faulted 或 Canceled 。 Task