Assembly assembly = null; string windowsPath = Path.Combine(Application.StartupPath, "Windows"); foreach (string dllFile in Directory.GetFiles(windowsPath, "*.dll")) { assembly = Assembly.LoadFile(dllFile); Type[] types = assembly.GetTypes(); foreach (Type t in types) { //增加你的代码 } }
结合DesigerHost可以实现类似VS动态加载控件