anmarti
anmarti

Reputation: 5143

How to know which classes inherit from another one in Visual Studio 2010?

I want some method, for example, placing the mouse over a class name and then be able to see all the classes within the project that inherit from this class.

For example, I have

public class MyClass{}

How can I know which other classes extend MyClass and navigate to them to see their code?

Upvotes: 0

Views: 88

Answers (4)

anmarti
anmarti

Reputation: 5143

Using the Productivity tools is a fastest an pretty way. Once installed hover the mouse on a ClassName, click the popup and select Derived Types. You'll get a list of all classes you're looking for.

Upvotes: 0

Rajesh Kannan
Rajesh Kannan

Reputation: 31

If you are ok to use Visual Studio extensions, there is an excellent set of tools from Visual Studio Platform team called "Productivity Tools". It has a tool known as "Solution Navigator". http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef

Please find information on how to use this tool from this blog: http://blogs.msdn.com/b/visualstudio/archive/2010/07/20/solution-navigator-blog-post.aspx

The section "View related information about classes and members (such as references or callers/callees for C#)" helps on what you require.

Over the course of time, I found it so helpful like you can search for any class or file name in the solution just by using its search bar. It is quite faster than the other commercial tools. Also it integrates well within the Visual Studio because it is just from the Visual Studio team.

Upvotes: 1

manojlds
manojlds

Reputation: 301047

Right click on a method in the interface -> Call Hierarchy ( shortcut Ctrl+k, Ctrl+t) -> In the call hierarchy window, look under Implements "method name"

You can also find all references and figure which ones implement the interface!

Well, if you can, get Resharper.

Upvotes: 1

Kugel
Kugel

Reputation: 19814

Vanilla Visual Studio does not have this feature.

Widely used Resharper from Jetbrains does: http://www.jetbrains.com/resharper/webhelp/Navigation_and_Search__Go_to_Inheritor.html

I think Resharper is well worth the money.

Upvotes: 2

Related Questions