I would like to execute some code from string. Could somebody tell me if that's possible?
using System;
namespace Test
{
class Program
{
static void Main(string[] args)
{
IEnumerable<int> testArray = Enumerable.Range(1, 100);
string testCommand = "testArray.Where(i => i % 2 == 0)";
???
IEnumerable<int> result = Exucute(testCommand); //return only even numbers
???
}
}
}