views:

329

answers:

3

I have a solution. I have an interface. I have several classes that implement the interface.

I can use "Find All References" in order to find where the interface is implemented, but it also returns results where the interface is the return type, or where a class explicitly implements an interface's method.

Is there a better way to quickly/easily find which classes implement the interface?

+2  A: 

Using the "Go to Inheritor" feature in Resharper or a similar plugin would do the trick.

PHeiberg
+4  A: 

Reflector (free) will show you this; load the dll and find the interface (F3) - expand the "Derived Types" node.

Marc Gravell
In the case of a website, where classes (can) live in the App_Code directory, what then?
SkippyFire
I can't say - I haven't used "web site" in a few years, preferring "web application project".
Marc Gravell
+1  A: 

Why not just search in the entire solution for this:

\:.*MyInterface

and enable regular expressions in the search box - that ought to do the job.

Edit: Fixed the regex, it was for java before, whoops.

Steffen
Not in C#; and there isn't a simple yet reliable version of : IMyInterface - it could be : SomeClass, IMyInterface | : SomeClass, ISomethingElse, IMyInterface, : SomeClass where T : IMyInterface, etc
Marc Gravell
IMyInterface was just an example - as SkippyFire says he has an interface, I presume he has a specific interface, and thus a name for it.The regex search really should work, it works for me in Visual Studio 2008.I've just edited the expression, as the other one was for Java - my bad.
Steffen
Sorry for the many comments, I totally misread your comment, and I can see be re-reading it, that you have a good point.However the regex is sound enough for SomeClass: ISomething, IMyInterfaceBut with generic constraints we have a problem.It could easily be done, if visual studio implemented a proper regex engine for search'n'replace, but alas it doesn't :-(
Steffen