LeavingMe.net

System.Configuration.ConfigurationSettings.AppSettings 已过时

2008-01-14 07:51:00

使用Microsoft Visual Studio 2005,习惯性的使用ConfigurationSettings类来读取应用程序配置文件的信息时,却被编译器提示说
警告“System.Configuration.ConfigurationSettings.GetConfig(string)”已过时:“This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.GetSection” 警告   1 “System.Configuration.ConfigurationSettings.AppSettings”已过时:“This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings” 注意:默认没有引用ConfigurationManager类,所以找不到System.Configuration命名空间的 ConfigurationManager类. 解决:首先添加加对System.Configuration.dll 文件的引用;:在将"System.Configuration.ConfigurationSettings.GetConfig替换为System.Configuration.ConfigurationManager.GetSection 将“System.Configuration.ConfigurationSettings.AppSettings”替换为System.Configuration.ConfigurationManager.AppSettings” MS对这一点提示比较隐晦而已—— This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings 上面那段话多了System.Configuration!

[陈源](http://leavingme.cnblogs.com/) 2008-01-14 07:51 [发表评论](http://www.cnblogs.com/leavingme/archive/2008/01/14/1166225.html#Feedback)
comments powered by Disqus