What are the best resources for learning CIL (MSIL)

一笑奈何 提交于 2019-12-20 09:23:23

问题


I'm an expert C# 3 / .NET 3.5 programmer looking to start doing some runtime codegen using System.Reflection.Emit.DynamicMethod. I'd love to move up to the next level by becoming intimately familiar with IL.

Any pointers (pun intended)?


回答1:


The best way to learn it, is to write something you understand, then look at the IL it created. Also, depending on what you are doing, you can use expression trees instead of emitting IL, and then when you compile the expression trees, those smart guys at microsoft create the IL for ya.




回答2:


In addition to Darren's answer, I'd suggest picking or inventing a toy language, and writing a simple compiler for it. Pick something that requires little parsing, like BF or a stack-based language, and you'll find that writing a compiler is actually simpler than it seems.




回答3:


.NET Reflector is great for examining the IL produced by C#/VB.NET.

It's a wonderful learning tool.




回答4:


The ECMA 335 specification is freely available for download here: http://www.ecma-international.org/publications/standards/Ecma-335.htm

Partition III is the most relevant for dealing with MSIL, but I'd strongly recommend partition I as well for any .NET developer as it will greatly solidify understanding of the platform.




回答5:


Expert .NET 2.0 IL Assembler. Although this book may be a little dated now, it was still a great overview for me.



来源:https://stackoverflow.com/questions/155357/what-are-the-best-resources-for-learning-cil-msil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!