I am trying to evaluate a math string and googled it a lot. I found a code snippet but didn't work for me. Here is the code
static decimal evaluate(string expression)
{
var loDataTable = new DataTable();
// ******* throws "The expression has a syntax error" message ******
var loDataColumn = new DataColumn("Eval", typeof(double), expression);
loDataTable.Columns.Add(loDataColumn);
loDataTable.Rows.Add(0);
return (decimal)(loDataTable.Rows[0]["Eval"]);
}
I am passing ((159,00)*(1,0))
as a string and throws
The expression has a syntax error
exception on the second line.
What do you think the problem is? thanks