We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
至于已经编译好的程序集。 Reflection 可以为您提供有关以下方面的大部分信息:对象结构。但要获得真正的代码,您需要深入了解 IL。
至于代码,在 Visual Studio 中打开,然后 VS 公开 COM 接口,许多插件都使用该接口。 EnvDTE 是围绕此接口的托管包装器。但文档很少。
As for already compiled assembly. Reflection can give you most info about object structure. But to get real code, you need to get down to IL.
As for code, that is open in Visual Studio, then VS exposes COM interface, that many of those plugins use. EnvDTE is managed wrapper around this interface. But documentation is scarce.
NRefactory 将为您执行此操作:
http://wiki.sharpdevelop.net/NRefactory.ashx
编辑:这是一个“解析器”,这正是您想要的。它将 C# 代码转换为抽象语法树,然后可以使用代码对其进行修改并转换回 C#。
NRefactory will do this for you:
http://wiki.sharpdevelop.net/NRefactory.ashx
Edit: This is a "parser" which is what you want. It converts C# code into an abstract syntax tree which can then be modified with code and translated back to C#.
如果您只想列出方法、类、属性名称,那么 Reflection 是一个很好的简单解决方案 - 例如,请参阅简单教程,例如 http://www.java2s.com/Tutorial/CSharp/0400__Reflection/ListMethods.htm
如果您想要更详细的分析,包括方法体,那么从一个或多个 Reflector 替代品的源代码开始可能是个好主意 - 例如
If you'd like just to list method, class, property names, then Reflection is a good simple solution - e.g. see simple tutorial like http://www.java2s.com/Tutorial/CSharp/0400__Reflection/ListMethods.htm
If you want more detailed analysis, including method bodies, then it might be a good idea to start from the source code from one or more of the Reflector replacements - e.g.