[Mono-list] eval statement
Wed, 21 Jan 2004 12:45:59 -0800
For simple expressions you can use XPath:
XPathNavigator nav = new XmlDocument ().CreateNavigator ();
Console.WriteLine (nav.Evaluate ("(7-1) div 2").ToString ());
Beyond that, you'll either need to write your own expression evaluator, or
build/load dynamic assemblies.
Here's a couple of articles:
> -----Original Message-----
> From: firstname.lastname@example.org
> [mailto:email@example.com] On Behalf Of Gonia
> Eric - egonia
> Sent: Wednesday, January 21, 2004 9:41 AM
> To: 'firstname.lastname@example.org'
> Subject: [Mono-list] eval statement
> Does anyone have a recommendation on how I can create an eval
> method similar to perl's or php's.
> I would like to take a string like "(7-1)/2" and pass it to a
> method that would return the value of the mathematical operation.
> Thanks for any help you can provide,