简体   繁体   English

Visual Studio调用层次结构:如何通过已实现的方法接口查找调用?

[英]Visual Studio Call Hierarchy : How to find calls through an implemented interface to a method?

with Visual Studio Call Hierarchy functionality I can find calls to a certain method. 使用Visual Studio调用层次结构功能,我可以找到对特定方法的调用。

However, it doesn't seem to be able to find class through an implemented interface. 但是,它似乎无法通过已实现的接口查找类。 Like in the following, if Method() is called through IFoo, these calls aren't found in the Call Hierarchy? 类似于以下内容,如果通过IFoo调用了Method()则在“调用层次结构”中找不到这些调用吗?

   interface IFoo
   {
       void Method();
   }

   class Foo : IFoo
   {
       public void Method() 
       {
           // ...
       }
   }

Is there some way to do this in plain VS or with some free plugin? 有什么方法可以在普通VS中或通过一些免费插件来做到这一点?

Resharper seems to be able to do this (with some problems with more complicated cases) as in C# - Can't find usage of method when inherited and used through an interface implemented by the subclass . Resharper似乎能够做到这一点(在更复杂的情况下会出现一些问题),就像在C#中一样-在通过子类实现的接口继承和使用时找不到方法的用法

br, Touko br,Touko

Well, I'd never heard of Call Hierarchy before; 好吧,我以前从未听说过呼叫层次结构; I always use Find Symbol References - Shift + F12 on anything, including method names. 我总是在任何地方使用查找符号引用-Shift + F12 ,包括方法名称。 This picks up calls via interfaces. 这通过接口代答呼叫。

Reshaper has feature called go to implementation . Reshaper具有称为转到实现的功能 It allows you to find all classes that implement particular method or interface. 它允许您查找实现特定方法或接口的所有类。

Also it has a find usages . 它还具有查找用法 And it is able to search usages from interface or directly from class depending on what you need. 它可以根据需要从界面或直接从类中搜索用法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何强制调用接口实现的方法? - How to forcibly call interface implemented method? 在Visual Studio 2015中查找方法调用 - Find method calls in Visual Studio 2015 如何使用Type.InvokeMember来调用显式实现的接口方法? - How to use Type.InvokeMember to call an explicitly implemented interface method? 如何调用在接口中定义并在C#中的类中实现的方法? - How to call a method defined in interface and implemented in class in C#? 如何在基类上调用显式实现的接口方法 - How to call an explicitly implemented interface-method on the base class 在Visual Studio 2010中可视化方法调用的调用堆栈 - Visualize call stack of method calls in Visual Studio 2010 Visual Studio调用层次结构视图:以编程方式调用它 - Visual Studio Call Hierarchy View: call it programmatically C# - 通过子类实现的接口继承和使用时,找不到方法的用法 - C# - Can't find usage of method when inherited and used through an interface implemented by the subclass 调用实现的接口方法,但区分它们对某些对象的调用 - Call implemented interface methods, but distinguish their calls on certain objects 在 Visual Studio 2008 中单步执行 C# 时如何找到方法调用者? - How can I find a method caller when stepping through C# in Visual Studio 2008?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM