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

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.

主站蜘蛛池模板: 山西省| 沙坪坝区| 淮滨县| 建平县| 泰来县| 新巴尔虎右旗| 沙洋县| 临颍县| 怀仁县| 墨竹工卡县| 河间市| 楚雄市| 休宁县| 叙永县| 新余市| 宁晋县| 西安市| 怀来县| 莱西市| 金塔县| 万全县| 互助| 静安区| 荥阳市| 芦山县| 酒泉市| 若羌县| 新巴尔虎右旗| 清丰县| 北宁市| 伊春市| 乐清市| 泰来县| 东辽县| 灯塔市| 云林县| 仁化县| 上高县| 崇文区| 威远县| 阿鲁科尔沁旗|