View Call Hierarchy in Visual Studio 2010

Visual Studio 2010 contains a very useful feature called ‘View Call Hierarchy’. This feature lets you dive into all the calls that are made ‘to’ a method, property or constructor as well as all the calls that are made ‘from’ that method, property or constructor. As given in the documentation “You can examine several levels of code to view complex chains of method calls and additional entry points to the code, which enables you to explore all possible execution paths

For example, right clicking on the LogOff() method brings up the ‘View Call Hierarchy’ option in the context menu

View Call Hierarchy

Clicking on the ‘View Call Hierarchy’ option brings up the following window which displays the calls that are made to LogOff() as well as the calls that are made from LogOff().

View Call Hierarchy

Double clicking these calls takes you to the specific line of code where the call is made from or where the call is made to. Extremely handy!

Will you give this article a +1 ? Thanks in advance

About The Author

Suprotim Agarwal
Suprotim Agarwal, ASP.NET Architecture MVP (Microsoft Most Valuable Professional) works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He is the Editor of a Developer Magazine called DNC Magazine. He has also written two EBooks 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook

Follow him on twitter @suprotimagarwal


Greg said...

Netbeans displays the call hierarchy as a graphic image. It has been available in the last few versions.

I started my recent C++ job without having any experience with an IDE. The company provided VS 2008 and Netbeans. I learned both, side by side. My favorite is Netbeans.

Netbeans has click through navigation, dock/undock windows, a better user interface for searching, and search results are kept around in tabs so you can refer to previous searches. And no expensive license.

Nenad Šelić said...

Is possible to run call hierarchy from csharp code?