ITPub博客

首页 > Linux操作系统 > Linux操作系统 > System.Configuration命名空间下找不到ConfigurationManager类

System.Configuration命名空间下找不到ConfigurationManager类

原创 Linux操作系统 作者:bluemirror 时间:2008-08-05 15:03:50 0 删除 编辑
这里谈到是三层编程在CLASS里调用的问题:

开始使用VS 2005,习惯性的使用ConfigurationSettings类来读取应用程序配置文件的信息时,却被编译器提示说:
警告 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 文件的引用~~

事后才留意到,原来MS对这一点还是提示了一下的,只不过比较隐晦而已——
This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings

注意到没有,上面这段话多了System.Configuration!这段~
如:   
string we=System.Configuration.ConfigurationManager.AppSettings["sql"];
      

如:  
System.Web.HttpContext.Current.Cache["Cache1"] = "Value1";
System.Web.dll

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/82080/viewspace-419045/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-04-24

  • 博文量
    121
  • 访问量
    425368