Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expression Parser

Status
Not open for further replies.

KoRUPT

Programmer
Jul 25, 2002
25
CA
Is there a built in expression parser (much like the VBScript Eval function) in C#? What I mean is something that will evaluate string functions as if they were an expression. ie:

int i;
i = 0;
i = Eval("1+1");
Console.WriteLine(i.ToString());
//Output: 2

I would rather not write one myself so if anyone knows of such a function please respond. Thank you.
 
Unfortunately, the closest thing you're going to find is what you can do within the limitations of the watch, autos, local, etc. windows while in Debug mode in .NET. The example that you posted wouldn't work in these windows. Having used other technologies that use them, I too can understand the convenience of using expression parsers.

You don't need to actually develop your own though. I performed a Google search and found a few developers that have already done this...in C# even. Neil Konitzer
Freisoft
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top