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

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.

主站蜘蛛池模板: 静宁县| 桐庐县| 高雄县| 西和县| 南漳县| 昭苏县| 神农架林区| 六安市| 铁力市| 库尔勒市| 资兴市| 宕昌县| 邹城市| 寻甸| 哈尔滨市| 永济市| 卢氏县| 巴马| 青浦区| 监利县| 芒康县| 黔东| 五大连池市| 墨竹工卡县| 建始县| 垫江县| 大田县| 西丰县| 镇江市| 菏泽市| 麟游县| 商丘市| 淳安县| 富蕴县| 新晃| 泰兴市| 秦安县| 贵港市| 竹溪县| 苗栗县| 远安县|