This is not so easy as Cristian told you. It will work once and more, but the problem is when you need to repeat the compilation of the code typed by the user multiple times if you load the freshly built assembly in your host application process again and again, as it is usually required. It will create a memory leak, which could be big. Here is why: there is a way to load yet another assembly, but there is
no a way to unload it. This is designed so because unloading is unsafe: what is some code will call a method which does not exist anymore? Except one case: you can load it in a separate application domain and unload the whole domain.
So, you would need to create a new application domain each time the user wants to execute a new edited code, build and load assembly, call some method and then unload the application domain. But then you will need to work through the application domain boundary, as domain are isolated as well as separate processes. Such separation means using IPC, which is a hassle. Nevertheless, this is quite possible to implement.
Please see my past answers to related questions:
Create WPF Application that uses Reloadable Plugins...[
^],
AppDomain refuses to load an assembly[
^];
As related to DOM and code parsing:
code generating using CodeDom[
^],
Create WPF Application that uses Reloadable Plugins...[
^];
This is about the simple part of it, when you don't need to reload assemblies:
Dynamically Load User Controls[
^],
C# Reflection InvokeMember on existing instance[
^].
—SA