Visual Studio ConfigurationSettings.AppSettings过时

uinbv5nw  于 2023-05-18  发布在  其他
关注(0)|答案(2)|浏览(86)

我在使用这个的时候得到一个警告:
ConfigurationSettings.AppSettings(“ArbitaryName”).ToString()

警告:

  • 公共共享只读属性AppSettings As System.Collections.Specialized.NameValueCollection'已过时:'此方法已过时,已被系统.配置!System.Configuration.ConfigurationManager. AppSettings '. *

我试过用..
System. out. println();

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

注意:我的系统。配置指向C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll

k97glaaz

k97glaaz1#

这应该可以。

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

ltskdhd12#

我在aspx文件中有类似的问题。错误信息:“公共共享重载只读属性AppSettings As NameValueCollection”的参数太多。修复:更改
<a href='<%ConfigurationManager.AppSettings("URL") %>'></a>

<a href='<%=ConfigurationManager.AppSettings("URL") %>'></a>

相关问题