TaskExtensions.SwallowException(Task) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
事件處理程式的例外狀況。 http://theburningmonk.com/2012/10/c-beware-of-async-void-in-your-code/
我們需要讀取例外狀況,以避免擲回 .NET 4.0 和以下的例外狀況。 請參閱http://stackoverflow.com/questions/25691114/where-does-an-async-task-throw-exception-if-it-is-not-awaited
public:
[System::Runtime::CompilerServices::Extension]
static void SwallowException(System::Threading::Tasks::Task ^ task);
public static void SwallowException(this System.Threading.Tasks.Task task);
static member SwallowException : System.Threading.Tasks.Task -> unit
<Extension()>
Public Sub SwallowException (task As Task)
參數
- task
- Task
對例外狀況進行的工作