CSharpScriptExecution.ExecuteMethod
Executes a complete method by wrapping it into a class, compiling and instantiating the class and calling the method.
Code should include full method header (instance type, return value and parameters)
Example: "public string HelloWorld(string name) { return name; }"
"public async Task
Async Method Note: Keep in mind that
the method is not cast to that result - it's cast to object so you
have to unwrap it:
var objTask = script.ExecuteMethod(asyncCodeMethod); // object result
var result = await (objTask as Task
public object ExecuteMethod(string code, string methodName, object[] parameters)
Parameters
code
One or more complete methods.
methodName
Name of the method to call.
parameters
any number of variable parameters