Hacker News new | ask | show | jobs
by yread 5722 days ago
well you can write it as

  var f = ((x) => x + 1).Compile();
  int b = f.Invoke(42);
1 comments

I don't think that would work. How would the compiler know the type of x and the return type of the lambda expression?
It 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-ba...