您的位置:首页 > 其它

使用ConfigurationManager.GetSection()来实现类的方法

2012-10-31 23:16 441 查看
由于ConfigurationManager.GetSection()返回的object类型,可以在配置节点写上类名,如

<configSections>
<!--读取权限配置节点-->
<section name="Permission" type="FrameWork.PermissionConfigLoad"/>
</configSections>

通过调用ConfigurationManager.GetSection("Permission"),然后该类实现接口  public class PermissionConfigLoad : IConfigurationSectionHandler

    {

        /// <summary>

        /// 实现IConfigurationSectionHandler接口Create方法

        /// </summary>

        /// <param name="parent"></param>

        /// <param name="configContext"></param>

        /// <param name="section"></param>

        /// <returns></returns>

        public object Create(Object parent, Object configContext, System.Xml.XmlNode section)

        {

      }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: