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

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.

主站蜘蛛池模板: 离岛区| 阿拉尔市| 石楼县| 蒙自县| 平山县| 鹤壁市| 确山县| 凭祥市| 南郑县| 山阳县| 东方市| 南宁市| 定西市| 银川市| 宜君县| 九龙坡区| 广南县| 江都市| 温宿县| 开平市| 北票市| 开江县| 娄烦县| 晋州市| 河津市| 锡林浩特市| 木里| 泰来县| 南昌市| 沅江市| 辰溪县| 垦利县| 惠东县| 阿图什市| 兰州市| 通河县| 延吉市| 凤山市| 水富县| 蕲春县| 布尔津县|