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
要为 接受异常的任务