What is the difference between using AppDomain and ConfigurationManager when getting the path to the configuration file?

When getting the file path of the current configuration file, what is the difference in using the namespace AppDomainand namespace ConfigurationManager? And when will you use one over the other?

For example, both return the same path:

string f1 = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

string f2 = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None ).FilePath;
+5
source share
1 answer

It comes to when and why you need a configuration file. The bottom line is:

  • The ConfigurationManager will pull out the configuration file for the application itself (possibly limited by the current user).
  • AppDomain ( , ).

, , / . , , , AppDomain . , , , , AppDomain , .

AppDomain , , AppDomain . AppDomain - .

, , , ( ). , , , ( ). ConfigurationManager .

, , , , , .

MSDN AppDomainSetup OpenExeConfiguration(), .

+9

All Articles