Timeline for How should I submit an anonymous lambda that has a self reference?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 11, 2018 at 6:40 | comment | added | adrianmp | @VisualMelon Of course! So there's little use for recursive lambdas now :| | |
Jan 9, 2017 at 17:39 | comment | added | VisualMelon |
Note that the code sample here won't compile, because C# will insist you assign f before using it in the lambda. For example Func<int, int> f = null; f = n => n < 2 ? 1 : f(n - 1) + f(n - 2);
|
|
Oct 20, 2016 at 21:13 | vote | accept | CommunityBot | ||
Oct 20, 2016 at 21:08 | comment | added | user19547 |
So the interesting thing about your second paragraph is that in C# you can't use the var keyword for anonymous lambdas so one could argue that the typed variable is required to consider it 'working', and yes a named function would indeed by shorter in this case.
|
|
Oct 20, 2016 at 21:06 | history | answered | Martin EnderMod | CC BY-SA 3.0 |