Is there a way to navigate to real implementation of method behind an interface?

后端 未结 15 1487
攒了一身酷
攒了一身酷 2020-12-07 08:58

In Visual Studio, when you right-click a method call, you go to the implementation of that method inside a class except if you access this method through an interface: in th

15条回答
  •  天涯浪人
    2020-12-07 09:36

    Depending on the version of Visual Studio that you have, I'll say conditionally "yes."

    I'm currently operating on Ultimate, and don't have other versions to verify this. That said, within Ultimate, you can use the Architecture Explorer to find implementations. It's a little more involved than the right click method, but here's how it works.

    • Go to View->Architecture Explorer (or CTRL-W, N)
    • Click on Class View and find the namespace that contains your interface in the list that opens.
    • To the right of the namespace list, is a vertical button that says Types. Click this
    • Select Interfaces
    • Choose your interface from the list
    • A vertical button that says Members will then appear to the right. Click that button
    • Choose Implemented by (under Inbound Navigation) and that will provide a list of implementations of your interface.
    • Double clicking on the implementation will take you to the class.

提交回复
热议问题