I have simple lambda as a string:
var str = "f => f.Substring(0, f.IndexOf(' '))";
which eventualy takes first word from the passed string.
What is the easiest way to compile/convert this peace of string into Func and make the following code to work.
Func<string, string> func = ...
var firstWord = func("Hello World");
Will Expression help me? Will appreciate working sample,
Thanks
You will need to examine the string and construct an expression from the provided string. There is no easy or built in method to obtain a method from a string like this.
Good luck.