C#: How to get all the classes that inherits from a specific type
Code snippet for getting all the classes that inherits from a specific type:
public IList GetAllDerivedClasses(Type baseType)
{
return baseType.Assembly.GetTypes().Where(
x =>
x.IsClass
&& x.IsSubclassOf(baseType)).ToList();
}
Published: 05.08.2010
blog comments powered by Disqus

