Translate C # to IL programmatically

I have my portfolio that uses the CSharpCodeProvider namespace to compile user-entered code programmatically. Is there a class in Reflection or one of the CSharp namespaces that will allow me to translate C # to MSIL?

How does Reflector or LINQPad do?

thank

+2


source to share


2 answers


Reflector translates IL to C #.

What you want is the opposite.



It's called Microsoft.CSharp.CSharpCodeProvider

.

You configure it programmatically, but then it runs the csc.exe compiler to generate whatever you like. If you set the target to "netmodule" I assume it will create an empty IL.

+2


source


Try looking at the System.Reflection.Emit namespace .



+1


source







All Articles