4 ms·
well you can write it as var f = ((x) => x + 1).Compile(); int b = f.Invoke(42);
by yread 16y ago
well you can write it as
var f = ((x) => x + 1).Compile();
int b = f.Invoke(42);
- oozcitak 16y agoI don't think that would work. How would the compiler know the type of x and the return type of the lambda expression?
- the_rara_avis 16y agoIt won't. In just about all cases, C# doesn't do backtracking to infer types. See Eric Lippert's posts: http://blogs.msdn.com/b/ericlippert/archive/2010/10/04/no-backtracking-part-one.aspx http://blogs.msdn.com/b/ericlippert/archive/2010/10/04/no-ba...