Is it possible to make a Func delegate an extension method?
For example, just like you could create the function
bool isSet(this string x) {return x.Length > 0;}
I’d like to be able to write something like
Func<string, bool> isSet = (this x => x.Length > 0);
Of course, the above is not syntactically correct. Is there anything that is? If not, is that a limitation in syntax or compilation?
Short answer: no, thats not possible.
Extension methods are syntactic sugar and can only be defined under certain circumstances (static method inside a static class). There is no equivalent of this with lambda functions.