在WindowsCE 中实现 ConfigurationManager 类

 

       在Windows 下的移动开发中,并没有提供对配置文件的操作类,即没有提供 ConfigurationManager 类。

       可是在开发中,却经常需要用到配置文件,需要相关的类库支持。既然微软没有提供,那只好自己动手了。

       在VS2008中新建类库项目,命名为:SmartDeviceCommons,新建 ConfigurationManager 类。详细代码如下:

 

 

 

 在项目中添加文件名为SmartDeviceCommons.dll.config 的配置文件。 这样,就可以使用和ConfigurationManager 类一样的功能了。但在此处值实现了 AppSettings 和 ConnectionStrings 节点。

      在微软的 Mobile Client Software Factory 中有更完美的实现。下载地址:http://www.microsoft.com/downloads/details.aspx?FamilyId=F9176708-9F57-4C0F-97FB-F9C65A9BBF22&displaylang=en

 

  此代码可以在 WindowsCE,pocketPC,smart phone 中使用。

  

posted on 2009-10-09 17:54  WQL.NET  阅读(206)  评论(0编辑  收藏  举报