配置文件里App.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <!-- 修改typename对应的value即可--> <add key="assemblyName" value="AbstractFactory"/> <add key="nameSpaceName" value="AbstractFactory"/> <add key="typename" value="FashionManClothes"/> </appSettings> </configuration> 使用: //assemblyName,nameSpaceName,typename从App.config中读取 string assembly =ConfigurationSettings.AppSettings["assemblyName"]; string fullname = string.Concat(ConfigurationSettings.AppSettings["nameSpaceName"] + "." + ConfigurationSettings.AppSettings["typename"]); AbstractClothes cloth = (AbstractClothes)Assembly.Load(assembly).CreateInstance(fullname); 此处typename对应的value里的值是AbstractClothes类的派生类。