简体   繁体   English

Visual Studio调用层次结构视图:以编程方式调用它

[英]Visual Studio Call Hierarchy View: call it programmatically

In a VSpackage, is there a way to programmatically call, on a method, the "call hierarchy view" from code and access (even from code) to its results? 在VSpackage中,是否有一种方法可以在方法上以编程方式从代码中调用“调用层次结构视图”,并访问(甚至从代码中)对其结果的访问?

For completeness: VSpackage target is Visual Studio 2013. 出于完整性考虑:VSpackage目标是Visual Studio 2013。

Update 更新
The final aim is to find how many times a given method (given its namespace and class) is used/called inside the opened solution. 最终目的是找出在打开的解决方案中使用/调用给定方法(给定其名称空间和类)的次数。

I'm going to say no. 我要说不。 The reason is the "call hierarchy view" isn't going to expose it's data set directly. 原因是“调用层次结构视图”不会直接公开其数据集。 Instead you'd be better served going after the data set directly. 相反,最好直接处理数据集。 You can use (the new C# compiler) to get this information. 您可以使用 (新的C#编译器)获取此信息。 See: How to use C# to find usages of a class or method? 请参阅: 如何使用C#查找类或方法的用法?

Alternatively, you could also use to the same end. 另外,您也可以将用于同一目的。 There is a tutorial on Code Project that shows how to use it: http://www.codeproject.com/Articles/408663/Using-NRefactory-for-analyzing-Csharp-code 有一个有关Code Project的教程,说明了如何使用它: http : //www.codeproject.com/Articles/408663/Using-NRefactory-for-analyzing-Csharp-code

Or if you just want to see how many times code is accessed in the IDE, you can upgrade to Visual Studio 2013 Ultimate and use Code Lens: http://blogs.msdn.com/b/zainnab/archive/2013/07/09/visual-studio-2013-preview-codelens-aka-code-information-indicators.aspx . 或者,如果您只想查看在IDE中访问代码的次数,则可以升级到Visual Studio 2013 Ultimate并使用代码透镜: http : //blogs.msdn.com/b/zainnab/archive/2013/07/ 09 / visual-studio-2013-preview-codelens-aka-code-information-indicators.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM