通用配置文件
<?xml version="1.0" encoding="utf-8" ?><configuration> <configSections> <section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </configSections> <appSettings> <add key="key1" value="value1"/> </appSettings></configuration>
ConfigurationFileMap fileMap = new ConfigurationFileMap(file); //Path to your config fileConfiguration configuration = ConfigurationManager.OpenMappedMachineConfiguration(fileMap);string value = configuration.AppSettings.Settings["key1"].Value;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)