根据C#中的BODMAS进行计算 [英] Making a calculation according to the BODMAS in C#
本文介绍了根据C#中的BODMAS进行计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们,我有一个由用户在文本框中构建的计算。
简而言之,他定义了他想要的格式,并将值稍后传递(在某些数据库查询之后)。
Guys I have a calculation that is built by a user in a text box. In short, he defines the format he wants and the values are passed on later(after some database queries).
例如。
(X + Y)* 55
eg. (X + Y) * 55
或者他也可以像
(X - 100) * 100
有什么方法可以用c#?
Is there any way of computing this with c# ?
注意:X和Y从数据库中检索。
NOTE : X and Y are retrieved from a database.
推荐答案
它是C#的易于使用和可扩展的计算引擎
its an easy to use and extensibile calculation engine for C#
使用方法示例为:
Expression e = new Expression("2 + 3 * 5");
Debug.Assert(17 == e.Evaluate());
这篇关于根据C#中的BODMAS进行计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文