There is an article explaining this here:
Compiling .NET code on-the-fly[
^]
It may not be exactly what you want, but it will give you the idea.
[edit]
A word of warning: If you implement this in a website, you leave a VERY big security hole in your server. Remember that the code will be run on the server, and .NET has access to anything it needs. If the code the user enters is the C# equivalent of "Delete c:\*.*" then the server will try to do it...
[/edit]