try this:
public static void Main()
{
string expression = "((159,00)*(1,0))";
decimal result = evaluate(expression.Replace(".","").Replace(",","."));
}
static decimal evaluate(string expression)
{
var loDataTable = new DataTable();
var loDataColumn = new DataColumn("Eval", typeof(double), expression);
loDataTable.Columns.Add(loDataColumn);
loDataTable.Rows.Add(0);
return decimal.Parse(loDataTable.Rows[0]["Eval"].ToString());
}
as I understand European notation, commas and periods are switched. So first remove any periods, then replace commas with periods using this:
expression.Replace(".","").Replace(",",".")
(to ensure a string like ((159.162,00)*(2,0))
doesn't break)
Also, note the return is changed to decimal.Parse(), and it works well