轻松进行IL代码检查的工具 [英] A tool for easy IL code inspection

查看:83
本文介绍了轻松进行IL代码检查的工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候我想快速查看我在C#中代码片段的IL表示,以了解各种代码语句在幕后到底发生了什么,就像这样做此处例如

Sometimes I would like to quickly see the IL representation of my code snippets in C#, to understand what exactly happens to various code statements under the hood, like it's done here for example.

我知道有ildasm Reflector ILSpy dotPeek 以及可能提供的其他一些工具。我想知道的是,与编写.net代码,将程序集加载到其中一个程序中并找到您感兴趣的代码相比,从编写几行代码到查看相应的IL是否有更好的方法。

I know there are ildasm, Reflector, ILSpy, dotPeek and probably quite some other tools available. What I'm wondering here is that if there is any more elegant way from writing some lines of code to seeing the corresponding IL, than compiling your .net code, loading the assembly into one of those programs and finding the code you are curious about.

也许有一个用于Visual Studio的插件,它会为构建并查看IL代码添加右键单击选项还是其他方便的方式?

Maybe having a plugin for visual studio, which would add a right click option for "build and see IL code" or any other convenient way?

编辑:

经过更多的谷歌搜索后,我发现 NDasm Codeplex项目(可以满足我的需求)-集成到Visual Studio中。

After some more googling I found NDasm codeplex project which does what I was looking for - integrates into visual studio.

但是vcsjones的LINQPad建议也很好,因此我将其标记为已接受,谢谢。

But vcsjones' LINQPad suggestion is great as well, thus I am marking it as accepted, thanks. A really useful tool ...

推荐答案

我通常使用 LINQPad 。只需粘贴一些C#并切换到IL视图即可。例如:

I typically use LINQPad for that. Just paste in some C# and switch to the IL view. For example:

我喜欢它,因为您也可以只发布表达式或语句而不是完整程序:

I like it because you can also just post expressions or statements instead of a full program:

最好,它是免费的(可选高级功能)。

Best of all, it's free (with optional premium features).

这篇关于轻松进行IL代码检查的工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆