views:

265

answers:

2

The closest I could find to this question was this one: http://stackoverflow.com/questions/26733/getting-all-types-that-implement-an-interface-with-c-3-5

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

+1  A: 

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
Thanks for the answer I'll try that reflector
Jeff Keslinke
+4  A: 

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
Thanks for the answer, I think I like RedGate's Reflector since it's free.
Jeff Keslinke