Visual Studio:如何显示从基类继承的所有类? [英] Visual Studio: How do I show all classes inherited from a base class?

查看:27
本文介绍了Visual Studio:如何显示从基类继承的所有类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio 中,如何显示从基类继承的所有类?

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

例如,在 ASP.NET MVC 中有几个 'ActionResult' 类型——它们都继承/实现了基类 ActionResult.

For example, in ASP.NET MVC there are several 'ActionResult' types -- and they all inherit from / implement the base class ActionResult.

看起来除非您知道"ViewJson 是有效的ActionResult 类型,否则您无法轻松找到这个信息出来了.

It looks like unless you just 'know' that View and Json are valid ActionResult types, there is no way you can easily find this information out.

请证明我是错的.

对象浏览器中是否有一些东西可以让您轻松找到?

Is there something in the object browser that makes this easy to find out?

我什至愿意为 Visual Studio 之外的工具提供建议,以发现有关各种类的信息.例如:Resharper 中有什么东西可以帮助我吗?

I'm even up for suggestions of tools outside of Visual Studio to discover this information about various classes. For example: is there something in Resharper that will help me out?

推荐答案

当然,Resharper 可以做到这个.还有更多.

Sure, Resharper can do this. And much more.

只需右键单击任意位置的类型名称,然后在上下文菜单中选择转到继承者"即可.转到继承者"也可以应用于导航到覆盖和接口方法实现的方法.对于接口,您可以再次调用Find Usages Advanced",只需右键单击)可以找到所有扩展和实现的位置.对于类型 - 派生类型.还有我最喜欢的功能 - 在任何类型/方法上按住 Control 键单击以导航到其声明.

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.

我认为这是 .net 开发人员必备的工具.

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

在 Resharper 9.2 中,在源代码中的任何类型上,rt-单击Find Usage Advanced",选择 Find="Derived" 和 Scope="Solutions and Libraries".
例如,要在来自任何供应商的包含的 DLL 中查找某个基类的所有继承者(在库和您的代码中),请在您的代码中使用该基类声明一个变量.然后右键单击您刚刚输入的基类名称.

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.

这篇关于Visual Studio:如何显示从基类继承的所有类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆