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

Local functions

The use of local functions might seem a little strange at first. They are in fact quite often used in most functional languages. C# 7.0 now allows us to do the same. So what exactly is a local function? Well, think of it as a helper method for a specific method. This helper method only really makes sense when used from the specific method and will not be useful for other methods in your application. It, therefore, makes sense to use it inside your existing method. Some might think that an extension method might be just as well suited, but extension methods should really be used to extend the functionality of many other methods. The usefulness of local functions will become evident in the following code example.

主站蜘蛛池模板: 黔西县| 青浦区| 榆树市| 伽师县| 当涂县| 喀喇| 太谷县| 渝中区| 上虞市| 德安县| 七台河市| 博客| 建平县| 古浪县| 平和县| 电白县| 鄂尔多斯市| 仁布县| 陆河县| 若尔盖县| 墨竹工卡县| 福安市| 林周县| 长沙市| 邵武市| 泾源县| 大余县| 丰县| 富阳市| 武乡县| 渝北区| 浠水县| 金塔县| 嘉峪关市| 永川市| 思南县| 安义县| 中阳县| 蒙城县| 壤塘县| 陆川县|