.net project app.config binding
How is the app.config binding in .Net开发者_高级运维?
Let's say if I have an application project referencing a class library project. The code ConfigurationManager.AppSettings["MySetting"]
in the class library project will read the value from app.config from the application project. Is my understanding correct?
So how about if we have 2 class library project, let's say A and B while A is referencing B. So will ConfigurationManager.AppSettings["MySetting"]
read the value from app.config in project A?
Thanks in advance.
The ConfigurationManager
will read from the configuration file that was loaded by the AppDomain when it loaded the application. This means that the application configuration that was local to the assembly was loaded and only its values will be available via ConfigurationManager
.
You are correct in both of your assumptions, by the way :)
精彩评论