4 ms·
well you can already define a lambda locally right now and do the exact same thing
by lacampbell 10y ago
well you can already define a lambda locally right now and do the exact same thing
- louthy 10y agoAlmost, you can't declare a generic local lambda. public void Test() { // Doesn't work Func<A, string> lam = (A a) => a.ToString(); // Works string LocalFunc<A>(A a) => a.ToString(); } Also I think if the local function doesn't close over any variables in the containing method then there's no additional memory allocation, whereas the lambda itself must be allocated.