How to find the implementations of an interface in Visual Studio 2013 & 2015
Now a days, it has become highly unlikely to find a robust software design and architecture which is not utilizing interfaces. During development, it's sometimes really frustrating to find the implementations of a method of an interface.
Specially if you have to do that over and over again everyday.
Fortunately in Visual Studio 2015 a new menu option was added that makes life much easier when we need to find the implementation(s) of methods in an interface.
Let's have an example:
class Program { interface IMyInterface { void DoSomething(); } class MyFirstImplemntation : IMyInterface { public void DoSomething() { Console.WriteLine("I am doing something!"); } } static void Main(string[] args) { IMyInterface obj = new MyFirstImplemntation(); obj.DoSomething(); Console.ReadLine(); } }
If you are using Visual Studio 2015 and wish to see the implementation of DoSomething method, you just need to right click on the method invocation and select 'Go To Implementation' option as follow:
If there is more than one implementations for this interface, you will be shown a list of references in a dialog window and then you can simply choose each reference to see the implementation.
But what to do in Visual Studio 2013?
As far as I know, the best way (out of the box) to see the implementation of a method is to right click on the method invocation and select 'View Call Hierarchy' option (or press Ctrl+K,Ctrl+T).
Then the Call Hierarchy window will be opened for you. If you expand 'Implements xxx' node, you will see all the implementations and by double clicking on any of them, you can navigate to the particular implementation.