What is the state of dynamic code evaluation in C #? For the very advanced feature of the application I'm working on, I would like for users to be able to enter a C # line of code that should be evaluated as logical.
Something like:
DateTime.Now.Hours > 12 && DateTime.Now.Hours < 14
I want to dynamically evaluate this string and commit the result as a boolean.
I tried Microsoft.JScript.Eval.JScriptEvaluate and it worked, but it is technically outdated and only works with Javascript (not perfect, but workable). In addition, I would like to be able to push objects into the script engine so that they can be used in the evaluation.
Some resources that I find are called dynamically compiled assemblies, but this is more overhead than I think I want to deal with.
So what is the state of the dynamic evaluation script in C #? Is this possible or am I out of luck?
reflection c # dynamic
Deane
source share