tags:

views:

43

answers:

2

Is it possible in C# to get types of subclasses from base class?

+4  A: 

Not directly, however you can use AppDomain.GetAssemblies() to get all the currently loaded assemblies, and then use Assembly.GetTypes() to get all the types in that assembly. Then use Type.IsSubclassOf() to determine if it's a subclass of the type you're after.

Dean Harding
Thank you. It works.
Polaris
+1  A: 

you can select the Assembly you want to check, get the types with the method Assembly.GetTypes() and test if each is a subclass with Type.IsSubclassOf()

see Assembly members and Type members

PierrOz