转换C#code到IL code [英] Convert C# code to IL code
问题描述
我如何得到C#code IL code?我能做到这一点的,EXTERN库,或存在内部功能?
编辑:我要显示IL code。在我与一个消息应用程序
How I can get IL code of C# code ? Can I do this with a extern library, or exists internal functions ?
EDIT : I want to show IL code in my application with a MessageBox.
推荐答案
编程?您可以使用反射来获得的MethodInfo
,然后调用<一个href="http://msdn.microsoft.com/en-us/library/system.reflection.methodbase.getmethodbody.aspx"><$c$c>MethodBase.GetMethodBody$c$c>以获得体。从 MethodBody
,你可以叫<一href="http://msdn.microsoft.com/en-us/library/system.reflection.methodbody.getilasbytearray.aspx"><$c$c>GetILAsByteArray$c$c>除其他事项外。
Programmatically? You can use reflection to get a MethodInfo
, and then call MethodBase.GetMethodBody
to get the body. From the MethodBody
, you can call GetILAsByteArray
amongst other things.
当然,如果你只是想自己研究它,有反射,的dotPeek ,ILDASM(在.NET SDK的一部分),毫无疑问,其他工具......
Of course, if you just want to examine it yourself, there's Reflector, dotPeek, ildasm (part of the .NET SDK) and no doubt other tools...
这篇关于转换C#code到IL code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!