Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio: How do I show all classes inherited from a base class?

People also ask

What are the inherited from the base class?

The class whose members are inherited is called the base class, and the class that inherits those members is called the derived class. A derived class can have only one direct base class. However, inheritance is transitive.

How do you access base class members in a derived class?

You can use both a structure and a class as base classes in the base list of a derived class declaration: If the derived class is declared with the keyword class , the default access specifier in its base list specifiers is private .

Which class do all classes in the .NET framework inherit from?

Every method defined in the Object class is available in all objects in the system as all classes in the . NET Framework are derived from the Object class.

What methods are not inherited from the base class?

Constructors, static initializers, and instance initializers are not members and therefore are not inherited.


For VS2012,

  1. Navigate to file in solution explorer
  2. Expand and select your class
  3. Right click the class item (not the file item) -> Derived Types

You don't necessarily need Reflector for this - Visual Studio's "Class Diagram" view will let you easily find all derived classes for a particular class as well. Right click on the class in "Class View" and choose "View Class Diagram". If the diagram doesn't show the level of detail you want for the hierarchy, right click on the box for the class in the diagram, and choose "Show Derived Classes".

Might not be as direct as ReSharper, but it's an option if you don't have R# already.

Unfortunately, I'm not certain which particular versions of Visual Studio have it.


Sure, Resharper can do this. And much more.

Just right click on type name in any place and choose "Go To Inheritor" in context menu. "Go To Inheritor" can be also applied to method for navigating to overrides and an interface method's implementations. For an interface you could call "Find Usages Advanced" again, just right click) where to find all extendings and implementations. For a type - derived types. And my favorite feature - click with holding Control on any type/method for navigating to its declaration.

I think it's a must-have tool for .net developers.


In Resharper 9.2, on any type in source code, rt-click "Find Usage Advanced", select Find="Derived" and Scope="Solutions and Libraries".
For example, to find all inheritors (both in the library and your code) of some base class in an included DLL from any vendor, declare a variable in your code with that base class. Then right-click on that base class name you just typed.


Starting from 'Visual Studio 2015 Update 1' you can simply right click on a class name in the class code editor and then select 'Go To Implementation" from the context menu : with Ctrl + F12 being the shortcut.

See https://blogs.msdn.microsoft.com/dotnet/2015/11/30/whats-new-in-visual-studio-update-1-for-net-managed-languages/ for more details.