I\'m typing an equation into a TextBox that will generate the graph of the given parabola. Is it possible to use an eval function? I\'m using C# 2010 and it doesn\'t have Mi
You can easily do this with the "Compute" method of the DataTable class.
static Double Eval(String expression)
{
System.Data.DataTable table = new System.Data.DataTable();
return Convert.ToDouble(table.Compute(expression, String.Empty));
}
Pass a term in form of a string to the function in order to get the result.
Double result = Eval("7 * 6");
result = Eval("17 + 4");
...