You might find this MSDN article interesting: http://msdn.microsoft.com/en-us/magazine/cc163791.aspx
As well as these books:
http://www.amazon.com/Expert-NET-2-0-IL-Assembler/dp/1590596463/ref=pd_bbs_sr_1/104-0844985-7433557?ie=UTF8&s=books&qid=1175791950&sr=8-1
While I agree with GregC in general there are times when this type of information is useful. But that is one tough question to be expected to answer in an interview (unless it's for the CLR team :)
There was a 1.1 version of the same book, but I haven't seen anything for the latest .NET release. It's an excellent book. I used it to write an OCR component in MSIL, as a learning project.
[Edit] @Curt is right, 3.0 and 3.5 are just extensions to 2.0, I hadn't plugged that in to my head yet. Now I've thought of a fun geek project... compare the disassembly of standard 2.0 code to the new LINQ/Lambda way of performing common tasks like filtering lists. For some reason I assumed that the magic was happening in new IL features, not just the compiler.
An easy way to learn about IL is to write the code in e.g. C# and look at the generated IL. That way you can easily see what various code constructs map to. For a great book on the subject, I recommend Expert .NET IL Assembler.
.NET assemblies don't use the traditional text segment to store their .NET code - only natively compiled code goes there. Instead they use special CLR structures inside the PE that only .NET assemblies have.
One of the "optional" headers in the PE file is the CLR Runtime Header, which has all the key information about where .NET-specific structures are located within the PE.
For more details on this, download the latest PE specification ("Microsoft Portable Executable and Common Object File Format Specification") from msdn.com.
For even more detailed explanations on how the many pieces of .NET executable code and corresponding data are organized in the PE, get Serge Lidin's book on the .NET assembler.
I can recommend this book:
Expert .NET 2.0 IL Assembler by Serge Lidin
https://www.amazon.com/Expert-NET-Assembler-Serge-Lidin/dp/1590596463
Also ILSpy is a very popular open source decompiler:
https://github.com/icsharpcode/ILSpy
Looking around in that source code can probably be enlightening for you.
It seems also that ILDasm (the MSIL disassembler that comes with Visual Studio) is open source:
https://github.com/dotnet/coreclr/tree/master/src/ildasm
Hope some of this can help you.
You might find this MSDN article interesting: http://msdn.microsoft.com/en-us/magazine/cc163791.aspx
As well as these books: http://www.amazon.com/Expert-NET-2-0-IL-Assembler/dp/1590596463/ref=pd_bbs_sr_1/104-0844985-7433557?ie=UTF8&s=books&qid=1175791950&sr=8-1
http://www.amazon.com/CLR-via-Dev-Pro-Jeffrey-Richter/dp/0735627045/ref=sr_1_1?ie=UTF8&s=books&qid=1277838859&sr=1-1
There are a few books that do cover IL:
Also some books on reverse engineering have sections on IL.
See also:
While I agree with GregC in general there are times when this type of information is useful. But that is one tough question to be expected to answer in an interview (unless it's for the CLR team :)
Web Pages and Blogs...
Books...
Expert .NET 2.0 IL Assembler by Serge Lidin
There was a 1.1 version of the same book, but I haven't seen anything for the latest .NET release. It's an excellent book. I used it to write an OCR component in MSIL, as a learning project.
[Edit] @Curt is right, 3.0 and 3.5 are just extensions to 2.0, I hadn't plugged that in to my head yet. Now I've thought of a fun geek project... compare the disassembly of standard 2.0 code to the new LINQ/Lambda way of performing common tasks like filtering lists. For some reason I assumed that the magic was happening in new IL features, not just the compiler.
An easy way to learn about IL is to write the code in e.g. C# and look at the generated IL. That way you can easily see what various code constructs map to. For a great book on the subject, I recommend Expert .NET IL Assembler.
.NET assemblies don't use the traditional
text
segment to store their .NET code - only natively compiled code goes there. Instead they use special CLR structures inside the PE that only .NET assemblies have.One of the "optional" headers in the PE file is the CLR Runtime Header, which has all the key information about where .NET-specific structures are located within the PE.
For more details on this, download the latest PE specification ("Microsoft Portable Executable and Common Object File Format Specification") from msdn.com.
For even more detailed explanations on how the many pieces of .NET executable code and corresponding data are organized in the PE, get Serge Lidin's book on the .NET assembler.