开发者

Programmatically translate C# to IL

I have my portfolio which uses the CSharpCodeProvider namespace to programmatically compile user entered code. Is there a class in Reflection or one of the "CSharp" 开发者_开发知识库namespaces which will allow me to translate C# to MSIL?

How does Reflector or LINQPad do this?


Reflector translates IL to C#.

What you want is the opposite.

It's called Microsoft.CSharp.CSharpCodeProvider .

You programmatically configure it, but then it runs the csc.exe compiler to generate whatever you like. If you set the target to "netmodule" I guess it would generate bare IL.


Try to look at System.Reflection.Emit namespace.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜