.net project app.config binding

谁说我不能喝 提交于 2019-12-25 02:47:08

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/1641857/net-project-app-config-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!