All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
利用PHP自定义错误处理器处理出错信息_[PHP教程]
delphi文件操作AssignFile过程
ASP.NET技巧:使用ASPX输出XML应注意的问题_[Asp.Net教程]
常用技巧:用PHP控制您的浏览器cache_php资料_编程技术
asp.net2.0中Cache对象的属性和方法
正则表达式中的组集合的使用_.net资料_编程技术
DataGrid和DataList中CommandButton的问题_[Asp.Net教程]
delphi 判断文件结尾的函数eof函数和eoin函数
深入ASP.NET数据绑定(下)——多样的绑定方式_[Asp.Net教程]
asp.net2.0动态加载主题
Reading number is top 10 pictures
Extremely rare TianShan Mountains snow lotus2
世界各国15岁的MM有什么不同
西班牙山村小景2
性感丰满身材火爆de美女1
陪睡门马睿菈自曝写真 称首拍大尺度照片3
Sora aoi mirror memorial classics1
人美胸美腿更美1
Soldier saw beauty after the reaction
The cat shit
这才是真正的人体艺术2
Download software ranking
Photoshop 8.0图象编辑软件
jdk1.6 for windows
传奇私服架设教程
Boxer's Top ten classic battle3
致我们终将逝去的青春
asp.netWeb服务器高级编程
Sora aoi, the maid, students' uniforms
网络管理员第三版
星际争霸1.08硬盘免安装版
Boxer's Top ten classic battle1
aaa published in(发表于) 2013/12/8 7:47:55 Edit(编辑)
.NET,2.0,中对配置文件的读写_.net资料_编程技术

.NET,2.0,中对配置文件的读写_.net资料_编程技术

.NET 2.0 中对配置文件的读写_.net资料_编程技术-你的首页-uuhomepage.com
  在基于 .net 2.0 的企业库中,原来的配置应用程序块被废除了,使用了 .net 2.0 自带的读写配置功能,下面我们就来看看 .net 2.0 中读写配置的功能。 即: ConfigurationManager 类
  注意:ConfigurationManager 是处理客户端应用程序配置文件的首选方法;不推荐使用任何其他方法。

  对于 Web 应用程序,建议使用 WebConfigurationManager 类。

  这个类的 AppSettings 属性 在以前1.0 的时候,就有了, 2.0 中增加了 ConnectionStrings 属性。

  这些都不是今天我们要探讨的内容,我们今天要探讨的内容,是把一个配置类保存到配置文件中,以及把这个配置类从配置文件中实例化出来。

  这个配置类,必须是 派生自System.Configuration.ConfigurationSection 类

  如下面的类就是一个配置类


using System.Text;
using System.Configuration;
namespace ConfigTest
{
 class ConfigDataClass : ConfigurationSection
 {
  public ConfigDataClass()
  { }

  [ConfigurationProperty("id")]
  public int ID{
   get{return (int)this["id"];}
   set{ this["id"] = value;}
  }

  [ConfigurationProperty("name")]
  public string Name{
   get{ return this["name"].ToString();}
   set{ this["name"] = value;}
  }

  public override string ToString(){
   StringBuilder info = new StringBuilder();
   info.AppendFormat("id = {0};name = {1}", ID, Name);
   return info.ToString();
  }
 }
}




添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.