This is not how it can work in principle. When you create a code from CodeDOM, it returns you some assembly. You should use Reflection to instantiate some class(es) of this assembly to start working with such assembly.
Remember, you cannot unload assembly. The only way is to compile assembly in memory (or load it) is a separate
AppDomain
.
AppDomain
can be unloaded, but you need IPC to work with its instance. To identify the class to instantiate, you need some interface (please, don't even think about identification of anything by name, it will work, but extremely unsupportable. You can also create a special assembly attribute to identify the type to be instantiated.
For all further detail, see my other Answers:
Create WPF Application that uses Reloadable Plugins...[
^]
code generating using CodeDom[
^].
You will find a lot of useful detail and skeletons of some systems.
—SA