Convert string contents into line of code?

  • Thread starter Thread starter BH
  • Start date Start date
B

BH

Hi all

does C# have some way to turn a string's contents ( from a db or whatever )
into an executable line of code?

int myValue = 0;
string lineOfCode = "myValue = 20;"
//somehow 'execute' the statement in the string....
lineOfCode.ExecuteMe(); //?? is this sort of thing possible ??
//myValue is now equal to 20

Thanks...
 

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