Converting IL to C# code

后端 未结 12 2170
青春惊慌失措
青春惊慌失措 2020-12-15 22:16

I need to convert the IL to c# code. I have an assembly and I am reading this assembly. I get MethodBody from MethodInfo and the methodbody has a method GetILAsByteArraY()

相关标签:
12条回答
  • 2020-12-15 22:57

    There is no tool in the BCL that will do this; however, there is a great tool called Reflector, which you can write your own add-ins for. So you could probally use this to get the data you want.

    0 讨论(0)
  • 2020-12-15 23:02

    The Lutz Roeder reflector was purchased and is no longer available for free download.

    There is now a free (once again) tool called ILSpy. I've found it to be very good, and it will not only generate C# code from IL but will also create a .csproj project if decompiling an entire DLL assembly.

    0 讨论(0)
  • 2020-12-15 23:02

    Can't you do this with Reflector?

    You can load an assembly and view it as VB.net/C#/IL...

    0 讨论(0)
  • 2020-12-15 23:03

    Let's see if I manage to get it in first: .NET Reflector! This really should be a FAQ...

    0 讨论(0)
  • 2020-12-15 23:05

    Reflector does this. Perhaps you could use Reflector against Reflector and learn how it handles the problem.

    You might also say why you want to do this - there may be a better solution to your overall problem.

    0 讨论(0)
  • 2020-12-15 23:07

    Maybe you should try Dis# if you don't wanna re-invent the wheel... It's almost the best tool in converting the code NetDASM has a tool that lets you convert C# to IL. maybe you should take a look at that.

    0 讨论(0)
提交回复
热议问题