Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
569 views
in Technique[技术] by (71.8m points)

inheritance - How to find what class(es) implements an interface (.Net)

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...