Expression Evaluation Problem in c# (equation)
Hi,
I am having a strnig variable which conatins a expression like 2*4+(9+9) etc..
when i try to evaluate this expression by using double.parse or convert.toDouble methods.. it throws me stringformatexception..
Please help
Thanks
Rohit Saxena
Hi,
Double.Parse and Convert.ToDouble functions just converts the string data into a Double. It does not performs calculations, even if you specify it on your string. Your string var is indeed invalid, valid string inputs must all be numerical. If you want to evaluate that expression you'll have to do the logic to parse each char and perform the reauired calculation (since im not aware of any .net class that would do the trick)
cheers,
Paul June A. Domag