Evaluates a supplied string as code

  • Thread starter Thread starter mg
  • Start date Start date
M

mg

Is there a simple way to evaluates a supplied string as
though it were code (C# in code behind). For example, eval
("int5.ToString()")? If so, could you show me how?
 
Hi mg,

It is not that simple but neither it is too difficult.
Basically, you'll have to create a class with method that holds your piece
of code.
You'll have to compile it and access it.
You'll want to take a look at CodeDom and stuff liket CodeSnippetExpression.
 
Back
Top