SingleTagSectionHandler.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Sys / System / Configuration / SingleTagSectionHandler.cs / 1 / SingleTagSectionHandler.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Configuration { 
    using System.Collections; 
    using System.Xml;
 
    /**
     * Single-tag dictionary config factory
     *
     * Use for tags of the form:  
     */
    ///  
    ///  
    public class SingleTagSectionHandler : IConfigurationSectionHandler {
        /** 
         * Create
         *
         * Given a partially composed config object (possibly null)
         * and some input from the config system, return a 
         * further partially composed config object
         */ 
        ///  
        ///    [To be supplied.]
        ///  
        public virtual object Create(Object parent, Object context, XmlNode section) {
            Hashtable result;

            // start result off as a shallow clone of the parent 

            if (parent == null) 
                result = new Hashtable(); 
            else
                result = new Hashtable((IDictionary)parent); 

            // verify that there are no children

            HandlerBase.CheckForChildNodes(section); 

            // iterate through each XML section in order and apply the directives 
 
            foreach (XmlAttribute attribute in section.Attributes) {
                // handle name-value pairs 
                result[attribute.Name] = attribute.Value;
            }

            return result; 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Configuration { 
    using System.Collections; 
    using System.Xml;
 
    /**
     * Single-tag dictionary config factory
     *
     * Use for tags of the form:  
     */
    ///  
    ///  
    public class SingleTagSectionHandler : IConfigurationSectionHandler {
        /** 
         * Create
         *
         * Given a partially composed config object (possibly null)
         * and some input from the config system, return a 
         * further partially composed config object
         */ 
        ///  
        ///    [To be supplied.]
        ///  
        public virtual object Create(Object parent, Object context, XmlNode section) {
            Hashtable result;

            // start result off as a shallow clone of the parent 

            if (parent == null) 
                result = new Hashtable(); 
            else
                result = new Hashtable((IDictionary)parent); 

            // verify that there are no children

            HandlerBase.CheckForChildNodes(section); 

            // iterate through each XML section in order and apply the directives 
 
            foreach (XmlAttribute attribute in section.Attributes) {
                // handle name-value pairs 
                result[attribute.Name] = attribute.Value;
            }

            return result; 
        }
    } 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK