如何读取配置文件app.config里的一个表DataTable 读取得存储,有现成的方法吗
解决方案 »
- C#套接字TCP侦听和发送重用问题
- lambda.Compile(); //抛出一个异常 Lambda 参数不在作用域内
- 大家进来看看。
- 谁知道这个c#语句是什么意思?
- 请问一个DataGrid的问题啊....
- 能从类实例知道其生成时的构造函数参数吗?
- 数据显示格式,smallmoney格式的转化
- 谁有vs.net2003的帮助啊?或者哪里有下载?谢!
- 在线等待:请问有关asp.net开发中的Codebehind技术,能不能改成调用bin目录下的.dll文件
- 请问基类中的虚方法到底有什么作用?
- 用Socket的话,要先绑定本机IP,Port,怎么检测本机的指定Port是否已被占用?
- 请用过ImagXpress7的朋友帮帮忙
<?xml version="1.0" encoding="utf-8" ?>
<Manager>
<IBody>Strong</IBody>
<IRoomSkill>FixRoom</IRoomSkill>
</Manager>
这些数据该如何读,要使用读取xml方法去读吗
{
public MyConfigHandler(){} public object Create(object parent,
object configContext, System.Xml.XmlNode section)
{
Manager mgt =new Manager();
mgt.IBody= section.SelectSingleNode("IBody").InnerText;
mgt.IRoomSkill= section.SelectSingleNode("IRoomSkill").InnerText;
return mgt;
}
}public class Manager
{
private string _ibody;
public string IBody
{
get { return this._ibody; }
set { this._ibody = value; }
} private string _iRoomSkill;
public string IRoomSkill
{
get { return this._iRoomSkill; }
set { this._iRoomSkill = value; }
}
}step 2. in your App.config<configSections>
...
<sectionGroup name="ManagerInfo">
<section name="Manager"
type="ConfigSections.MyConfigHandler,ConfigSections"/>
</sectionGroup></configSections><ManagerInfo>
<Manager>
<IBody> Strong </IBody>
<IRoomSkill> FixRoom </IRoomSkill>
</Manager> </ManagerInfo>step3. to read Manager from app.config in your codes, you needManager obj=(Manager)ConfigurationSettings.GetConfig("ManagerInfo/Manager");Good luck!