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.ConfiguredTaskAwaitableAn 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)