The lambda needs to infer the type of the delegate used from its context. An implicitly typed variable will infer its type from what is assigned to it. They are each trying to infer their type from the other. You need to explicitly use the type somewhere.
There are lots of delegates that can have the signature that you're using. The compiler needs some way of knowing which one to use.
The easiest option is to use:
Func<string, string> moo = x => x.ToString();
If you really want to still use var
, you can do something like this:
var moo = new Func<string, string>(x => x.ToString());