Well, you can use CSharpCodeProvider to compile code at execution time. Have a look at Snippy for an example of this. In this case you'd need to compile the user code in a method which accepts a List
called data
. My experience is that it works, but it can be slightly fiddly to get right - particularly in terms of adding the appropriate references etc.