問題:
I am looking at the new implementations in C# 7.0 and I find it interesting that they have implemented local functions but I cannot imagine a scenario where a local function would be preferred over a lambda expression, and what is the difference between the two.我正在查看C# 7.0中的新實現,我發現它們實現了局部函數很有趣,但我無法想象局部函數比 lambda 表達式更受歡迎的場景,以及兩者之間的區別是什麼。
I do understand that lambdas are anonymous
functions meanwhile local functions are not, but I can't figure out a real world scenario, where local function has advantages over lambda expressions我知道 lambda 是anonymous
函數,而本地函數不是,但我無法弄清楚一個真實的場景,其中本地函數比 lambda 表達式有優勢
Any example would be much appreciated.任何例子將不勝感激。 Thanks.謝謝。
解決方案:
參考一: https://en.stackoom.com/question/2lnAr參考二: https://stackoom.com/question/2lnAr