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

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.

主站蜘蛛池模板: 高州市| 泗洪县| 辽宁省| 方城县| 托克托县| 宜都市| 修文县| 石台县| 仙居县| 东辽县| 普洱| 贺兰县| 新闻| 新乐市| 磐安县| 桐乡市| 太谷县| 连江县| 社旗县| 吐鲁番市| 高碑店市| 天峨县| 信丰县| 沂水县| 五原县| 阜新| 平果县| 淳化县| 永仁县| 三江| 武乡县| 锡林浩特市| 克什克腾旗| 青岛市| 通州市| 阜南县| 南安市| 砚山县| 嘉禾县| 安龙县| 原阳县|