窗口设计 获取指定配置文件
作者:互联网
ExeConfigurationFileMap exc = new ExeConfigurationFileMap();
string BasePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;//获取当前程序所在的目录
exc.ExeConfigFilename = BasePath + "YJKJ.Scan.JY.exe.config";//确认配置文件位置
XmlOperate xmlScanConfig = new XmlOperate(BasePath + "YJKJ.Scan.JY.exe.config");
string dz= BasePath + "YJKJ.Scan.JY.exe.config";
Configuration AppConfig = ConfigurationManager.OpenMappedExeConfiguration(exc, ConfigurationUserLevel.None);
//取值
string Temp = AppConfig.AppSettings.Settings["Temp"].Value;
this.Temp.Text = Temp;
获取本地配置文件内容
//string a = ConfigurationManager.AppSettings["Temp"];
标签:窗口,配置文件,Temp,config,BasePath,获取,JY,string 来源: https://www.cnblogs.com/djx3364542986/p/15075513.html