问题
I wonder if there is a way to visually represent a call stack of a method.
Meaning for example:
- ServiceAdapter.GetMessage
- calls Manager.GetMessage
- calls Agent.GetMessage
- calls Repo.GetMessageById
- calls Agent.GetUserById
- calls Repo.GetUserById
- calls Agent.GetRating
- call Repo.GetRatingForMessage
- calls Agent.GetMessage
- ..
- calls Manager.GetMessage
This way it would by very easy to navigate through a piece of code and visualize its dependencies.
Is there an existing extension for this in Visual Studio?
回答1:
You're looking for the Call Hierarchy window.
Select a method, then press Ctrl + K, T.
回答2:
On the method name, left click with your mouse and click Call Hierarchy.
来源:https://stackoverflow.com/questions/6058453/visualize-call-stack-of-method-calls-in-visual-studio-2010