J
John Hardin
All:
Is it possible at runtime to determine the names of all classes derived
from a given class?
Is it possible at runtime to determine the names of all classes derived
from a given class?
Is it possible at runtime to determine the names of all classes derived
from a given class?
John,
The answer depends on where you expect to find these derived classes
(in the same assembly, in other loaded assemblies or in any assembly
on the system)?
John Hardin said:Ideally I'd like to not have to worry about which assembly the derived
class is in; probably as a practical limit, all the assemblies loaded for
the current application.
I've continued to work on this and think it is possible. I'm continuing to
read up on the reflection classes and methods.
Is it possible at runtime to determine the names of all classes derived
from a given class?
Adrian Mascarenhas (MS) said:You can use System.Reflection to do this by getting the Type of the
current class and then searching all types in the assembly and
checking to see if their BaseType matches this type.