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)?
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)?
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.
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.
You can find all the referenced assemblies of a given assembly, and
load any ones which haven't been already loaded, then recurse, etc.
It's not particularly pretty, but it's doable.
If you search on groups.google.com for
insubject:"dependency walker" author:[email protected]
you'll find some sample code I wrote a while ago.
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.
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.
Usually, a better way of checking whether one type is derived from
another or implements a given interface is to use
Type.IsAssignableFrom. This means you can check for "grandchildren"
types as well without checking the base type of the base type, etc.
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.