简体   繁体   中英

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?

For completeness: VSpackage target is 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. See: How to use C# to find usages of a class or method?

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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