How can I make the following work?
string formula = "({0} / {1}) + {2}";
string calc = string.format(formula,10,3,2);
double calculatedvalue = double.Parse(calc);
and have it return 5.3333333
How can I make the following work?
string formula = "({0} / {1}) + {2}";
string calc = string.format(formula,10,3,2);
double calculatedvalue = double.Parse(calc);
and have it return 5.3333333
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jan MontanoRank #1,295 · 1.3K reputationPosted Jun 26, 2008, 10:11 PM EDT
This will get you started
Dynamic Formula Processing Library
*EDIT: here's a freeware. check it out.ELMathSolver .NET 2.31 freeware
David Johnson24 reputationPosted Jun 30, 2008, 5:04 AM EDT
Andry Lebedev10 reputationPosted Oct 2, 2011, 10:23 PM EDT
IExpression expression2 = BaseExpression.Parse("x/(95+y)");
var result = expression.Execute(...);
example