eval function

G

Guest

Hi all,

Does C# have an Eval function like JScript does? I have a need to evaluate
some code on the fly...

TIA!
 
L

Lebesgue

No, C# does not have such function. Do a quick search in this newsgroup,
this has been discussed at least 5 times here.
 
W

William Stacey [MVP]

Check "Math Parser" for example of creating a general Eval yourself for your
utils lib.
 
T

TerryFei

Hi,
Welcome to MSDN Newsgroup!

As far as I known, C# doesn't provide this function. If we want to evaluate
some code, we can use following two ways to achieve this goal. You could
choose one of them as you like,
1. Invoke Eval Function using JScript.NET. You could refer to the following
article,
Title: An Eval Function for C# using JScript.NET (JavaScript)
URL: http://www.odetocode.com/Code/80.aspx

2. Implement Eval function from scratch using C#. I browse an article from
internet and hope it's helpful for you.
Title: Runtime C# Expression Evaluator
URL: http://www.codeproject.com/csharp/runtime_eval.asp

I hope the above information is useful for you. If there is any question,
please feel free to join the community and we are here to support you at
your convenience. Thanks again and have a nice day.

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
T

TerryFei

Hi ,

I just wanted to check how things are going and whether or not your problem
has been resolved.

If there is any question, please feel free to let me know. Thanks for your
understanding!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top