本地函数与 Lambda C# 7.0 - Local function vs Lambda C# 7.0

问题:

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章