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.
 

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

Back
Top