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)

Task.ConfigureAwait的更多相关文章

  1. 【C# Task】理解Task中的ConfigureAwait配置同步上下文

    原文:https://devblogs.microsoft.com/dotnet/configureawait-faq/ 作者:Stephen 翻译:xiaoxiaotank 静下心来,你一定会有收获 ...

  2. async/await Task Timeout

    async/await Task Timeout 在日常的电脑使用过程中,估计最难以忍受的就是软件界面"卡住""无响应",在我有限的开发生涯中一直都是在挑战 它 ...

  3. 任务(task)

    任务概述 线程(Thread)是创建并发的底层工具,因此有一定的局限性(不易得到返回值(必须通过创建共享域):异常的捕获和处理也麻烦:同时线程执行完毕后无法再次开启该线程),这些局限性会降低性能同时影 ...

  4. C# 中 ConfigureAwait 相关答疑FAQ

    C# 中 ConfigureAwait 相关答疑FAQ 在前段时间经常看到园子里有一些文章讨论到 ConfigureAwait,刚好今天在微软官方博客看到了 Stephen Toub 前不久的一篇答疑 ...

  5. # ConfigureAwait常见问题解答

    原文: https://devblogs.microsoft.com/dotnet/configureawait-faq/ .NET 在七多年前在语言和类库添加了 async/await .在那个时候 ...

  6. 理解C#中的ConfigureAwait

    原文:https://devblogs.microsoft.com/dotnet/configureawait-faq/ 作者:Stephen 翻译:xiaoxiaotank 静下心来,你一定会有收获 ...

  7. 走进Task(2):Task 的回调执行与 await

    目录 前言 Task.ContinueWith ContinueWith 的产物:ContinuationTask 额外的参数 回调的容器:TaskContinuation Task.Continue ...

  8. 【C# Task】开篇

    概览 在学task类之前必须学习线程的知识. 以下是task命名空间的类的结构图 1.2种任务类型: 有返回值task<TResult> .无返回值task. 2.2座任务工厂 TaskF ...

  9. 【C# Task】TaskCompletionSource

    TaskCompletionSource具体功能 用于封装一个没有不带委托的任务实列.可以在其他线程控制该任务实列什么时候结束.取消.错误.类似于EventWaitHandle的功能. 属性 Task ...

随机推荐

  1. [编码]ASCII、GBK、Unicode(万国码) 和 UTF-8

    American ASCII编码 (American Standard Code for Information Interchange,美国信息互换标准代码)  China    gbk编码     ...

  2. background使用

    background-position 有两个参数,定义背景图片起始位置可选值有: center top left right bottom px % background-size 可以用 px % ...

  3. dubbo之泛化引用

    使用泛化调用 泛化接口调用方式主要用于客户端没有 API 接口及模型类元的情况,参数及返回值中的所有 POJO 均用 Map 表示,通常用于框架集成,比如:实现一个通用的服务测试框架,可通过 Gene ...

  4. 读书笔记「Python编程:从入门到实践」_10.文件和异常

    10.1 从文件中读取数据  10.1.1 读取整个文件 with open(~) as object: contents=object.read() with open('C:/Users/jou/ ...

  5. 【C++】颜色的设置

    1.改变整个控制台的颜色用 system("color 0A"); 其中color后面的0是背景色代号,A是前景色代号.各颜色代码如下: 0=黑色 1=蓝色 2=绿色 3=湖蓝色  ...

  6. button提交表单 a标签提交表单

    <form name="searchForm" id="searchForm" method="get" action="/ ...

  7. mvc自定义控件

    //自定义一个DatePicker.cshtml文件@helper Init() { <link href="~/Content/mobiscroll.custom-2.5.0.min ...

  8. cocos creator 底部按钮touch延迟

    cocos论坛里有这个问题: http://forum.cocos.com/t/ios-touchstart-bug/63367我的引擎版本:"engine_version": & ...

  9. 团体程序设计天梯赛-练习集-L1-032. Left-pad

    L1-032. Left-pad 根据新浪微博上的消息,有一位开发者不满NPM(Node Package Manager)的做法,收回了自己的开源代码,其中包括一个叫left-pad的模块,就是这个模 ...

  10. vue-路由使用

    路由安装 终端下载路由插件 npm install vue-router --save-dev 配置 在main.js中引入插件 //Router 为自定义名 vue-router 为插件的名字 im ...