我写了一个class,
实现了IConfigurationSectionHandler,
就OK了,
为什么系统内置的就不好用呢?
:(

解决方案 »

  1.   

    你的代码有两处错误:
    1.配置节中type的
    指定从配置文件中读取节的配置节处理程序类的名称,也就是说
    MyConfigurationReader类 必须改成SingleTagSectionHandler而且命名空间必须是System.Configuration。
    2.SingleTagSectionHandler必须实现IConfigurationSectionHandler接口。
      

  2.   

    SingleTagSectionHandler是系统内置的,当然实现了IConfigurationSectionHandler接口
      

  3.   

    自己搞定了,
    using System;
    using System.Collections;
    using System.Configuration;
    using System.Xml;
    using System.Collections.Specialized;   
    namespace ServiceSales.ClassLib
    {
    /// <summary>
    /// CConfig 的摘要说明。
    /// </summary>
    public class CConfig : IConfigurationSectionHandler
    {
    public Object Create(Object parent, object configContext, XmlNode section)
    {
    NameValueCollection settings;
    try
    {
    NameValueSectionHandler baseHandler = new NameValueSectionHandler();
    settings = (NameValueCollection)baseHandler.Create(parent, configContext, section);
    }
    catch
    {
    settings = null;
    }
    return settings;
    }
    }
    }