.net project app.config binding

How to bind app.config in .Net?

Say, if I have an application project that references a class library project. The ConfigurationManager.AppSettings["MySetting"] code in the class library project will read the value from app.config from the application project. Do I understand correctly?

So how about if we have a class 2 library project, say A and B, when A refers to B. So, ConfigurationManager.AppSettings["MySetting"] will read the value from app.config in project A?

Thanks in advance.

0
source share
1 answer

ConfigurationManager will be read from the configuration file that AppDomain loaded when the application loaded. This means that the application configuration was loaded that was local to the assembly, and only its values ​​would be available through the ConfigurationManager .

You are right in both of your assumptions, by the way :)

+2
source

Source: https://habr.com/ru/post/1299782/


All Articles