System.Configuration.ConfigurationSettings.AppSettings’ is obsolete: ‘"This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings"


Whenever we read values from configuration, the people who worked on earlier versions of .net has a habit of writing the below line of code for reading values from configuration.

string strValue = System.Configuration.ConfigurationSettings.AppSettings[“KeyValue”];

The fix is very simple, just add System.Configuration as reference to your project and change ConfigurationSettings to ConfigurationManager. You don’t see any warning now.

string strValue = System.Configuration.ConfigurationManager.AppSettings[“KeyValue”];

Hope this helps.

Happy Coding

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s