Obsolete function

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

When using 'ConfigurationSettings.AppSettings.Get' I get the below warning.
What is the problem and how can I fix it?

Thanks

Regards

= Warning Message ============================

Warning 9 'Public Shared ReadOnly Property AppSettings() As
System.Collections.Specialized.NameValueCollection' is obsolete: 'This
method is obsolete, it has been replaced by
System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
 
Hi

When using 'ConfigurationSettings.AppSettings.Get' I get the below warning.
What is the problem and how can I fix it?

Thanks

Regards

= Warning Message ============================

Warning 9 'Public Shared ReadOnly Property AppSettings() As
System.Collections.Specialized.NameValueCollection' is obsolete: 'This
method is obsolete, it has been replaced by
System.Configuration!System.Configuration.ConfigurationManager.AppSettings'

They have changed (much improved) the configuration management api's
in .NET 2.0. This is telling you that you may want to switch to the
new api's. You do this by adding a reference to
System.Configuration.dll, and then you can access your appsettings
section via ConfigurationManager.AppSettings.

Also, you may want to check out the My namespace stuff in VB2005 - it
has a lot of support for settings.
 
Hi

There is no dll under System.Configuration. Also System.Configuration is
already imported. Using ConfigurationManager.AppSettings.Get(key) instead of
ConfigurationSettings.AppSettings.Get(key) gives the error
'ConfigurationManager' is not declared.

Thanks

Regards
 
John,

Try changing it to this:

System.Configuration.ConfigurationManager.AppSettings

Ed

John said:
Hi

There is no dll under System.Configuration. Also System.Configuration is
already imported. Using ConfigurationManager.AppSettings.Get(key) instead of
ConfigurationSettings.AppSettings.Get(key) gives the error
'ConfigurationManager' is not declared.

Thanks

Regards
 
Using System.Configuration.ConfigurationManager.AppSettings.Get(key) gives
the error 'ConfigurationManager' is not a member of 'Configuration'.

Many Thanks

Regards


EdB said:
John,

Try changing it to this:

System.Configuration.ConfigurationManager.AppSettings

Ed
 
Hi

There is no dll under System.Configuration. Also System.Configuration is
already imported. Using ConfigurationManager.AppSettings.Get(key) instead of
ConfigurationSettings.AppSettings.Get(key) gives the error
'ConfigurationManager' is not declared.

Thanks

Regards







- Show quoted text -

System.Configuration.dll - go and add it to your project references.
System.Configuration.ConfigurationManager lives in that dll. VB2005 -
may very well add it automatically, because of the new my
functionality. I can assure you that in .net 2.0 there most certainly
is a system.configuration.dll - i work in C#, and it does not import
it by default.
 
Back
Top