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()
Re-Inventing the wheel surely a better way to learn! you will have to create your own class that would convert iL to C#.This requires the knowledge of Intermediate language.
I assume you have already converted the Byte Array to IL instructions just like we see in ildasm.exe,Using Reflection.Emit.OpCodes,OpCode.OperandType,BitConvertor.ReadByte(),BitConvertor.ReadInt32 etc.
Don't reinvent the wheel; use Lutz Roeder's .NET Reflector.
If you want to do it yourself, you could start from the old Cecil.Decompiler and enhance it, see the source code and an old post of Jb. Evain announcing the project (Link down).
Let me be the first to suggest you grab a copy of Red Gate's Reflector.
You should just use .NET Reflector if you have the assembly. Also try the file gen addon.
For the search engine people, Reflector ain't free anymore. But a newer and better and not to mention FREE tool is being offered from telerik called JustDecompile. I just downloaded this and its so awesome and its just beta. Apparently telerik promises free forever.