简体   繁体   中英

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.

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?

   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?

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 .

br, Touko

Well, I'd never heard of Call Hierarchy before; I always use Find Symbol References - Shift + F12 on anything, including method names. This picks up calls via interfaces.

Reshaper has feature called go to implementation . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM