visual-studio Visual Studio - 在源代码级别显示对函数的所有调用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/336051/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio - show all calls to a function in source code level
提问by Timothy Chung
I am wondering if there is any way to list all the calls to a function in source code, so that I could see the dependencies if I modify that function.
我想知道是否有任何方法可以在源代码中列出对函数的所有调用,以便在修改该函数时可以看到依赖项。
One method I use is to search the function name in the "Entire Solution" but I am looking for a better way.
我使用的一种方法是在“整个解决方案”中搜索函数名称,但我正在寻找更好的方法。
回答by Mr Fooz
Right-click on the call and select "Find All References".
右键单击呼叫并选择“查找所有引用”。
回答by grepsedawk
A brute force method is to change the name of the function and recompile and look at the errors. Sometimes I have trouble with the Find References functionality in VS.
一种蛮力的方法是更改函数的名称并重新编译并查看错误。有时我在使用 VS 中的 Find References 功能时遇到问题。
回答by softarn
On method declaration: Ctrl+K, Ctrl+T
在方法声明上: Ctrl+ K, Ctrl+T
回答by Mauricio Scheffer
Use NDepend. It comes with a VS add-in that allows you to do CQL queries on the fly. See this screenshot.

