System.Configuration.ConfigurationManager.AppSettings [“key”]和System.Configuration.ConfigurationSettings.AppSettings [“key”]之间的主要区别是什么?
ConfigurationManager have more functional than ConfigurationSettings as list below
1. ConfigurationManager can access appsetting and connectionstring section
2. ConfigurationManager provide function that you can use to read and write config.
3. Permission by user level
4. ...... and other that you can see on msdn
Refer to http://msdn.microsoft.com/En-US/library/system.configuration.configurationmanager.aspx
ConfigurationSettings.AppSettings is obsolete. ConfigurationManager.AppSettings is the replacement.
Keep in mind that the ConfigurationManager object is in a different (DLL) assembly even though the namespace is the same.
ConfigurationManager Namespace: System.Configuration Assembly: System.Configuration (in System.Configuration.dll)
ConfigurationSettings Namespace: System.Configuration Assembly: System (in System.dll)
Anton
Sometimes it's a good idea to read the docs..
http://msdn.microsoft.com/en-en/library/system.configuration.configurationsettings(v=vs.80).aspx
Provides runtime versions 1.0 and 1.1 support for reading configuration sections and common configuration settings.
In other words, ConfigurationSettings class is deprecated.
'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: Obsolete means old or no longer in use. It has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.