System.Configuration.ConfigurationManager.GetSection
好几次在代码中使用了System.Configuration.ConfigurationSettings.GetConfig方法,但每次使用之后都出现如下提示:

但奇怪的是每次按系统提示调用System.Configuration.ConfigurationManager.GetSection方法时都出现以下错误:命名空间“System.Configuration”中不存在类型或命名空间名称“ConfigurationManager”(是缺少程序集引用吗?)。以前都尝试失败后就继续使用GetSection方法,今天再次尝试又出错,于是就去查阅了MSDN,关于ConfigurationManager类的说明如下:

关于ConfigurationSettings类的说明如下:

哈哈,原来ConfigurationSetting属于system.dll程序集中,而ConfigurationManager属于system.configration.dll程序集中,系统默认引入的程序集中不包含system.configration.dll程序集,所以只需引用system.configration.dll程序集就可以了。
但奇怪的是每次按系统提示调用System.Configuration.ConfigurationManager.GetSection方法时都出现以下错误:命名空间“System.Configuration”中不存在类型或命名空间名称“ConfigurationManager”(是缺少程序集引用吗?)。以前都尝试失败后就继续使用GetSection方法,今天再次尝试又出错,于是就去查阅了MSDN,关于ConfigurationManager类的说明如下:
关于ConfigurationSettings类的说明如下:
哈哈,原来ConfigurationSetting属于system.dll程序集中,而ConfigurationManager属于system.configration.dll程序集中,系统默认引入的程序集中不包含system.configration.dll程序集,所以只需引用system.configration.dll程序集就可以了。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步