1.配置文件Config
<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><appSettings><add key=\"xxxx\" value =\"12345\"/></appSettings></configuration>
2.获取key值
同一项目,可以直接取值
private static string xxxx = ConfigurationManager.AppSettings[\"xxxx\"].ToString();
不同项目,配置路径访问
ExeConfigurationFileMap exc= new ExeConfigurationFileMap();//设置路径,选一种即可exc.ExeConfigFilename = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + \"Config.config\";exc.ExeConfigFilename = @\"D:\\Config\";Configuration AppConfig = ConfigurationManager.OpenMappedExeConfiguration(exc, ConfigurationUserLevel.None);//取值string xxxx = AppConfig.AppSettings.Settings[\"xxxx\"].Value;
爱站程序员基地
![(原创)[C#] 一步一步自定义拖拽(Drag&Drop)时的鼠标效果:(一)基本原理及基本实现-爱站程序员基地](https://aiznh.com/wp-content/uploads/2022/07/20220721231016-62d9dcd85c40b-220x150.gif)

