eval function

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
No, C# does not have such function. Do a quick search in this newsgroup,
this has been discussed at least 5 times here.
 
Check "Math Parser" for example of creating a general Eval yourself for your
utils lib.
 
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.)
 
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.)
 
Back
Top