- C# 7 and .NET Core Cookbook
- Dirk Strauss
- 130字
- 2021-07-03 00:11:53
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.
推薦閱讀
- Getting Started with Gulp(Second Edition)
- Learning Apex Programming
- Wireshark Network Security
- Scratch 3.0少兒編程與邏輯思維訓練
- 軟件工程
- JavaScript 程序設計案例教程
- jQuery開發基礎教程
- Learning Concurrent Programming in Scala
- Android嵌入式系統程序開發:基于Cortex-A8(第2版)
- JSP程序設計實例教程(第2版)
- Clojure for Finance
- Learning Scrapy
- Scratch 3.0少兒積木式編程(6~10歲)
- 你也能看得懂的Python算法書
- 給產品經理講技術