官术网_书友最值得收藏!

Asynchronous availability

Another small improvement is that you can use the await keyword inside catch and finally blocks. This was not initially allowed when this incredibly useful feature was added to C# 5. There is not a lot more to say about this. The implementation is complex, but you don't need to worry about this unless you're interested in the internals. From a developer's point of view, it just works, as in this simple example:

catch (Exception e) when (e?.Message?.Length > 0)
{
await Task.Delay(200);
}

This feature has been improved in C# 7, so read on. You will see async and await used a lot throughout this book. Asynchronous programming is a great way of improving performance and not just from within your C# code.

主站蜘蛛池模板: 永年县| 洛宁县| 临海市| 商水县| 光山县| 闻喜县| 道孚县| 新丰县| 喀喇沁旗| 古交市| 永善县| 丰原市| 天全县| 宜兰市| 建昌县| 高州市| 孟连| 沂水县| 仁布县| 金寨县| 祁阳县| 西畴县| 宝鸡市| 吉木萨尔县| 林州市| 隆昌县| 东丰县| 武夷山市| 新巴尔虎左旗| 乐至县| 丰顺县| 夏津县| 盘山县| 大同县| 阿克陶县| 中西区| 墨竹工卡县| 和硕县| 建水县| 茶陵县| 洪湖市|