basically I want to do this:
Func<string> f = ()=> MyMethodName();
only having a string name of a method, i.e.:
Func<string> f = "MyMethodName";
Can this be done? Any problems, caveats? Can Reflection help? Can I first check if a method exist?
You don’t need a lambda expression at all here. You can use
Delegate.CreateDelegate:That way you avoid a level of indirection, and you also do the reflection part once instead of on every invocation.