Friday, April 25, 2008

(Last) ConfigurationSectionHander using LINQ to XML

Craig Andera's last ConfigurationSectionHandler revised
, using LINQ to XML.

public class XElementConfigurationSectionHandler :
    IConfigurationSectionHandler
{
public XElementConfigurationSectionHandler() {}

public Object Create(Object parent
    , Object configContext
    , XmlNode section)
{
    XElement xel;

    using (XmlNodeReader r = new XmlNodeReader(section))
    {
        xel.Load(r);
    }

    return xel;
}
}