Visual Studio:如何显示所有继承自基类的类?

编程入门 行业动态 更新时间:2024-10-25 02:26:49
本文介绍了Visual Studio:如何显示所有继承自基类的类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

除非你只是知道查看和 Json 是有效的 ActionResult 类型,没有办法你可以很容易找到这个信息。

在对象浏览器中有一些东西让这很容易找到?

我在Visual Studio之外的工具的建议找到这个关于各种类的信息。例如:Resharper中有什么可以帮助我?

解决方案

当然, Resharper 可以做到这一点。

只要在任何地方点击类型名称,然后在上下文菜单中选择转到Inheritor。 Go To Inheritor也可以应用于导航到覆盖的方法和接口方法的实现。对于一个接口,你可以调用查找使用高级againd,右键单击)在哪里可以找到所有扩展和实现。对于类型派生类型。 我最喜欢的功能 - 点击控制任何类型/方法导航到其声明。

我认为这是一个必须有的工具

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

For example, in ASP.NET MVC there are several 'ActionResult' types -- and they all inherit from / implement the base class 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.

Please prove me wrong.

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

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?

解决方案

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" againd, 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 developers.

更多推荐

Visual Studio:如何显示所有继承自基类的类?

本文发布于:2023-11-05 19:10:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1561617.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!