C# Runtime Compilation

added by BlackWasp
9/26/2011 9:34:12 AM

158 Views

The .NET framework includes classes that allow the code generator and compiler to be controlled from within an assembly. This allows C# source code, held in a string array, to be compiled at run time and executed using basic reflection techniques.


2 comments

dpeterson
9/26/2011 9:35:03 AM
It seems pretty cool, but do you have any examples of when it would be beneficial to perform runtime compilation? I could see it being useful for adding C# scripting to your applications, but it seems like Lua is a more popular choice in that scenario.

BlackWasp
9/26/2011 5:39:42 PM
I've used it where I've created code from diagrams and workflow but admittedly in that case I created DLLs, rather than compiling in memory. I wrote about it because I too find it pretty cool :D