3 ms·
For comparison, I came up with this in C# Func<int, int, int> sum = (x, y) => x + y; I had to specify the type explicitly, could not use 'var' type inferenc
by IDisposableHero 15y ago
For comparison, I came up with this in C#
Func<int, int, int> sum = (x, y) => x + y;
I had to specify the type explicitly, could not use 'var' type inference; the error is "Cannot assign lambda expression to an implicitly typed local variable". This is because the lambda could mean more than one kind of thing (delegate, expression tree, Func<>). Yeah, it's c# baggage.
Of course, once the type is known, you could do
var sum2 = sum;