.net项目app.config绑定(.net project app.config binding)

编程入门 行业动态 更新时间:2024-10-15 12:35:46
.net项目app.config绑定(.net project app.config binding)

.Net中的app.config绑定如何?

假设我有一个引用类库项目的应用程序项目。 类库项目中的代码ConfigurationManager.AppSettings["MySetting"]将从应用程序项目的app.config中读取值。 我的理解是否正确?

那么如果我们有2个类库项目,假设A和B引用B,那么怎么样?那么ConfigurationManager.AppSettings["MySetting"]将从项目A中的app.config中读取值?

提前致谢。

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.

最满意答案

ConfigurationManager将读取AppDomain在加载应用程序时加载的配置文件。 这意味着程序集本地的应用程序配置已加载,只有其值可通过ConfigurationManager 。

顺便说一句,你的两个假设都是正确的

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

更多推荐

本文发布于:2023-08-04 09:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413950.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   项目   app   net   binding

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!