Given a dynamic if statement in a String is there a method in .net to evaluate and return the correct result.
I.E.
static void Main(string[] args)
{
String a = "if(\"Alex\" == \"Alex\"){return 1;}else{return 0;}";
passThroughTest.Program.evalStatement(a);
}
public static void evalStatement(String statement)
{
//Evaluation of Statement
}
This isn't perfect but in this case the end result would be a 1. This seems 'stupid' from this point of view, but its for a more complex engine which needs to draw on similar syntax to evaluate.
Am I at a point where I need to write a parser of some sort and evaluate the statements...?
Thanks for your help!