c# - 'System.Configuration.ConfigurationSettings.AppSettings' 已过时

标签 c# visual-studio class class-library

我收到以下警告

'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: '"This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings"'

如何解决?

最佳答案

添加对程序集 System.Configuration 的引用。

然后在顶部(假设使用 C#)使用 System.Configuration(在 VB.NET 中导入 System.Configuration)。

使用 ConfigurationManager.AppSettings["MySetting"] 访问设置!

关于c# - 'System.Configuration.ConfigurationSettings.AppSettings' 已过时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3959605/

相关文章:

JQuery 类的障碍

python - __init__ 和 __call__ 有什么区别?

visual-studio - app.config 转换

c++ - 如果我切换到另一个应用程序,我的MFC应用程序将卡住

c# - 防止在 DataGridView 控件中选择多个单元格

c# - Windows 窗体整个屏幕的屏幕截图,调用窗口除外?

visual-studio - 函数_OpenSSLDie中引用的未解析的外部符号__imp____iob_func

java - 在持久性实体中使用 Java 构造函数

c# - WPF - 帮助将 XAML 绑定(bind)表达式转换为代码隐藏

c# - 为什么 WinRT 需要 DefaultOverloadAttribute?