ConfigurationSettings.AppSettings已过时

时间:2017-02-16 23:04:12

标签: vb.net visual-studio

我在使用时收到警告:

  

ConfigurationSettings.AppSettings( “ArbitraryName”)。的ToString()

警告:

公共共享ReadOnly属性AppSettings As System.Collections.Specialized.NameValueCollection'已过时:'此方法已过时,已被System.Configuration!System.Configuration.ConfigurationManager.AppSettings'替换。

我尝试过使用..

  

ConfigurationManager.AppSettings [ “ArbitraryName”]的ToString();

*The issue with this  is that it cannot be casted as a string.* 

注意:我的System.Configuration指向C:\ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ System.Configuration.dll

1 个答案:

答案 0 :(得分:1)

这应该有用..

System.Configuration.ConfigurationManager.AppSettings("ArbitraryName")