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

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.

主站蜘蛛池模板: 伊春市| 开封市| 武邑县| 武鸣县| 太仆寺旗| 公安县| 贵港市| 雅安市| 怀集县| 大埔县| 霞浦县| 广水市| 淮滨县| 资溪县| 尼勒克县| 托里县| 榕江县| 莱州市| 原平市| 澄江县| 安福县| 大埔区| 分宜县| 同德县| 武清区| 南郑县| 长汀县| 斗六市| 乡宁县| 东兴市| 门头沟区| 扶绥县| 乌拉特前旗| 枣强县| 教育| 信丰县| 永丰县| 中山市| 临沧市| 山丹县| 康乐县|