我刚刚得到一堆(大部分未记录的)C# 代码,我想在深入研究并开始重构之前直观地了解它的结构。 我过去(用其他语言)使用生成调用图的工具完成了此操作。
您能推荐一个有助于发现 C# 结构的好工具吗?
更新
除了这里提到的工具之外,我还看到(通过管道)人们说.NET Reflector 和 CLR Profiler 有此功能。 有这些方面的经验吗?
I just got a heaping pile of (mostly undocumented) C# code and I'd like to visualize it's structure before I dive in and start refactoring. I've done this in the past (in other languages) with tools that generate call graphs.
Can you recommend a good tool for facilitating the discovery of structure in C#?
UPDATE
In addition to the tools mentioned here I've seen (through the tubes) people say that .NET Reflector and CLR Profiler have this functionality. Any experience with these?
发布评论
评论(8)
NDepend 在这方面非常擅长。 另外,Visual Studio 2008 Team System 有许多功能可以让您跟踪圈复杂度,但它比 NDepend 基础得多。 (运行代码分析)
NDepend is pretty good at this. Additionally Visual Studio 2008 Team System has a bunch of features that allow you to keep track of cyclomatic complexity but its much more basic than NDepend. (Run code analysis)
关于 NDepend,它可以生成一些可用的调用图,例如:
通过按父类、命名空间或项目对其方法进行分组,可以使调用图更加清晰:
查找有关 NDepend 调用图的更多说明 此处。
Concerning NDepend, it can produce some usable call graph like for example:
The call graph can be made clearer by grouping its method by parent classes, namespaces or projects:
Find more explanations about NDepend call graph here.
虽然有点晚了,但 http://sequenceviz.codeplex.com/ 是一个很棒的工具,可以显示调用者图/序列图。 这些图表是通过逆向工程 .NET 程序集生成的。
It's bit late, but http://sequenceviz.codeplex.com/ is an awesome tool that shows the caller graph/Sequence diagram. The diagrams are generated by reverse engineering .NET Assemblies.
截至今天(2017 年 6 月),同类中最好的工具是 Resharper 的 Inspect 功能。 它允许您找到所有来电、去电、值来源/目的地等。
与上述其他工具相比,ReSharper 最好的部分是:它的错误较少。
As of today (June 2017), the best tool in class is Resharper's Inspect feature. It allows you to find all incoming calls, outgoing calls, value origin/destination, etc.
The best part of ReSharper, compared to other tools mentioned above: it's less buggy.
我使用 doxygen 取得了一些成功。 这有点令人困惑,但免费而且有效。
I've used doxygen to some success. It's a little confusing, but free and it works.
Visual Studio 2010。
另外,在逐个方法的基础上 - Reflector(分析器 (Ctrl+R);“取决于”和“使用者”)
Visual Studio 2010.
Plus, on a method-by-method basis - Reflector (Analyzer (Ctrl+R); "Depends On" and "Used By")
SequenceViz 和 DependencyStructureMatrix for Reflector 可能会帮助您:http://www.codeplex.com/reflectoraddins
SequenceViz and DependencyStructureMatrix for Reflector might help you out: http://www.codeplex.com/reflectoraddins
我不确定它是否会仅通过源代码来完成此操作,但是 ANTS Profiler 将为正在运行的应用程序生成一个调用图(无论如何可能更有用)。
I'm not sure if it will do it over just source code, but ANTS Profiler will produce a call graph for a running application (may be more useful anyway).