using System; using System.Reflection; using System.Linq; public class BaseClass { } public class DerivedClass1 : BaseClass { } public class DerivedClass2 : BaseClass { } class Program { static void Main() { Type baseType = typeof(BaseClass); Assembly assembly = Assembly.GetExecutingAssembly(); var derivedTypes = assembly.GetTypes() .Where(t => t.IsSubclassOf(baseType)); foreach (var type in derivedTypes) { Console.WriteLine(type.Name); } } }
标签:几个,System,class,基类,using,BaseClass,public From: https://www.cnblogs.com/gatran/p/18157303