I was always wondering if there is any method to find all derived types for the given type within an assembly. It would be handy to just pass either a class or an interface type and it will return me all its subs. I’ve come out with a method does that. It finds all the derived types of an given type. The given type could be a class(concrete or abstract) or an interface. The derived types could be class, struct or interface.

Here is the data structure that was used for testing,

From the data structure in the diagram, the tests have been covered with

Slight error in the examples though as they should read “Assembly.GetEntryAssembly().FindDerivedTypesFromAssembly(typeof(MyClass3), false)” given that FindDerivedTypesFromAssembly is an extension method.