2

The closest I could find to this question was this one: Getting all types that implement an interface

But that is for use in code, and to use it I'd have to change the code, recompile and run. I was wondering if there is a simpler way for me to just lookup all classes that implement a certain interface.

I seem to be faced with the question fairly often enough that I am seeking some easier/more generic way to find my answer. Most recently I wanted to find out what classes I could use that implement ISet, it didn't matter to me which class, just needed one to use to create an instance.

So I was wondering if there was any way to just find all classes that implement a given interface?

Thanks, Jeff

Community
  • 1
  • 1
Jeff Keslinke
  • 4,278
  • 5
  • 30
  • 49

2 Answers2

5

Using ReSharper, right-click on the Interface, go to Implementation, choose the one you want to see from the list it populates.

I don't think there's a way to do it programatically, but if you just mean in the IDE, this is the easiest way to do so.

Chris Doggett
  • 19,959
  • 4
  • 61
  • 86
1

No there's not an easier way. I guess that way is pretty easy to do. It's just three lines. You can cache the results in a list or dictionary (in case you want to test it for a collection of interfaces) if you need to do it many times in a row.

In case you need just as a tool, Reflector does it.

Mehrdad Afshari
  • 414,610
  • 91
  • 852
  • 789