This Blog Has A New Home!

This blog has been moved to Articles already here will remain intact, while new content will only be added to the new location at

Tuesday, February 06, 2007

JScript Eval Method In C#

JavaScript and JScript languages provide a convenient Eval method that allows for dynamic evaluation of expressions. This functionality can be duplicated in C# using Microsoft's JScript CodeDomProvider and Reflection. Following class automatically compiles an in-memory assembly using JScript CodeDomProvider. The Eval method uses this assembly to dynamically evaluate specified expressions:

Using this class, we can execute statements such as:

No comments:

New Articles On Software Rockstar