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

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.

主站蜘蛛池模板: 江永县| 张家界市| 文水县| 北碚区| 阿合奇县| 合山市| 吉木萨尔县| 酒泉市| 民权县| 托克逊县| 菏泽市| 汾西县| 金溪县| 米泉市| 方城县| 黎平县| 绥滨县| 灵川县| 佛坪县| 克东县| 防城港市| 洛川县| 苏尼特左旗| 且末县| 如东县| 新丰县| 鄂托克旗| 莆田市| 周宁县| 正镶白旗| 临桂县| 区。| 宝丰县| 平塘县| 瑞丽市| 砀山县| 溧阳市| 延寿县| 呼图壁县| 禹州市| 南郑县|