.NET框架如何处理app.config? [英] How does .NET framework deal with app.config?
本文介绍了.NET框架如何处理app.config?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在,许多项目都依赖于配置文件,.net框架提供了许多有用的类来读取它.但是当我从app.config中读取特定元素(添加)时,我不知道真正的过程:
例如:
Now, many project depend on configure file, .net framework provide lots of useful class to read it.but i don''t know the real process when read the specific elements(add) from app.config:
eg:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="LightCtrlSysLib.Properties.Settings.LightDbConnectionString"
connectionString="Data Source=(local);Initial Catalog=LightDb;
Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
它会触发特定事件吗?我知道我的想法很简单,如果出错的话.
is it will trigger specific event?I know my idea is so simple,if wrong.
how to design xml file realize this idea?
推荐答案
zhoudong写道:
zhoudong wrote:
是我会触发特定事件吗?我
is it will trigger specific event?I
否,app.config中的任何内容都不会触发任何事件.
No, nothing in your app.config will trigger any event.
这是一个静态类,在应用程序启动时会初始化.没有与该类相关的事件.
It''s a static class that''s initialized when the application starts. There are no events associated with the class.
这篇关于.NET框架如何处理app.config?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文