Can you enumerate all inherited classes?

J

jacques

Hi all,

I've written a load of classes which inherit from another base class
which I've written. Is it possible to enumerate all the classes which
inherit from a particular base class? I'd like to dynamically produce
a list or collection of all these classes, so when I add another
dirved class or dll containing a dirved class which inheirts from my
base class it will appear in my list/collection.

Hope someone can help. any ideas?
 
J

jacques

Sorry I babbled a bit there!

In short, how can I get a list of types/classes which inherit from
another class?
 
G

Guest

(e-mail address removed) wrote in @p15g2000hsd.googlegroups.com:
Sorry I babbled a bit there!

In short, how can I get a list of types/classes which inherit from
another class?

System.Reflection.Assembly.GetTypes

http://msdn2.microsoft.com/en-
us/library/system.reflection.assembly.gettypes.aspx

From there you can loop through all the types in the class and check what
they inherit from or implement.
 
J

jacques

(e-mail address removed) wrote in @p15g2000hsd.googlegroups.com:



System.Reflection.Assembly.GetTypes

http://msdn2.microsoft.com/en-
us/library/system.reflection.assembly.gettypes.aspx

From there you can loop through all the types in the class and check what
they inherit from or implement.

I'll give this a go then... thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top