using System;
using System.Data;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Console.WriteLine(this.Evaluate("1+3*10/2")); // 16
}
private decimal Evaluate
(string
exp) {
var table = new DataTable();
var column = table.Columns.Add();
var row = table.Rows.Add();
return decimal.Parse(row[0].ToString());
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CgpuYW1lc3BhY2UgV2luZG93c0Zvcm1zQXBwbGljYXRpb24xCnsKICAgIHB1YmxpYyBwYXJ0aWFsIGNsYXNzIEZvcm0xIDogRm9ybQogICAgewogICAgICAgIHB1YmxpYyBGb3JtMSgpCiAgICAgICAgewogICAgICAgICAgICBJbml0aWFsaXplQ29tcG9uZW50KCk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHZvaWQgRm9ybTFfTG9hZChvYmplY3Qgc2VuZGVyLCBFdmVudEFyZ3MgZSkKICAgICAgICB7CiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKHRoaXMuRXZhbHVhdGUoIjErMyoxMC8yIikpOyAvLyAxNgogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBkZWNpbWFsIEV2YWx1YXRlKHN0cmluZyBleHApCiAgICAgICAgewogICAgICAgICAgICB2YXIgdGFibGUgPSBuZXcgRGF0YVRhYmxlKCk7CiAgICAgICAgICAgIHZhciBjb2x1bW4gPSB0YWJsZS5Db2x1bW5zLkFkZCgpOwogICAgICAgICAgICBjb2x1bW4uRXhwcmVzc2lvbiA9IGV4cDsKICAgICAgICAgICAgdmFyIHJvdyA9IHRhYmxlLlJvd3MuQWRkKCk7CgogICAgICAgICAgICByZXR1cm4gZGVjaW1hbC5QYXJzZShyb3dbMF0uVG9TdHJpbmcoKSk7CiAgICAgICAgfQogICAgfQp9Cg==