Task.ConfigureAwait

 

 

 

public ConfiguredTaskAwaitable ConfigureAwait(
    bool continueOnCapturedContext
)

Configures an awaiter used to await this Task.

Parameters

continueOnCapturedContext
Type: System.Boolean

true to attempt to marshal the continuation back to the original context captured; otherwise, false.

Return Value

Type: System.Runtime.CompilerServices.ConfiguredTaskAwaitable

An object used to await this task.

 

 

 

结构体

ConfiguredTaskAwaitable 

Provides an awaitable object that enables configured awaits on a task.

Remark:

此结构体,是编译器专用的

This type is intended for compiler use; do not use it directly in your code.

 

 

在UI线程当中使用await的时候,需要使用ConfigureAwait(false)

 

posted @ 2016-06-01 18:51  ChuckLu  阅读(1036)  评论(0编辑  收藏  举报