3 ms·
Almost, you can't declare a generic local lambda. public void Test() { // Doesn't work Func<A, string> lam = (A a) => a.ToString();
by louthy 10y ago
Almost, 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.