Possible Duplicate:
How can I evaluate a C# expression dynamically?
Let me describe my issue in an example. There is a string variable in my program:
string func = @"
void printHello()
{
Console.WriteLine(""Hello world!"");
}
";
Is there any method to let me call this printHello function?
Thanks for any replies.
You can dynamically create and execute code using CodeDomProvider.
Look here for an example: http://blogs.msdn.com/b/digitalnetbizz/archive/2004/01/31/create-assembly-in-memory-and-run-it.aspx