开发者

.net project app.config binding

开发者 https://www.devze.com 2022-12-10 05:18 出处:网络
How is the app.config binding in .Net开发者_高级运维? Let\'s say if I have an application project referencing a class library project. The codeConfigurationManager.AppSettings[\"MySetting\"] in the c

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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消