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

由于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)
        {

      }



}

你可能感兴趣的:(使用ConfigurationManager.GetSection()来实现类的方法)