System.Configuration.NameValueSectionHandler.Create C# (CSharp) Метод

Create() публичный Метод

public Create ( object parent, object context, XmlNode section ) : object
parent object
context object
section System.Xml.XmlNode
Результат object
        public object Create(object parent, object context, XmlNode section) {
            return CreateStatic(parent, section, KeyAttributeName, ValueAttributeName);
        }

Usage Example

Пример #1
0
        public object Create(object parent, object context, XmlNode section)
        {
            IDictionary directories;
            NameValueSectionHandler nameValueSectionHandler;
            XmlNodeList nodes;
            DirectoryConfiguration directory;
            NameValueCollection properties;

            directories = new ListDictionary();

            nameValueSectionHandler = new NameValueSectionHandler();

            nodes = section.SelectNodes("directory");

            foreach(XmlElement element in nodes) {
                if(element.GetAttributeNode("name") == null)
                    throw(new ConfigurationException("Name not specified.", element));

                if(element.GetAttributeNode("type") == null)
                    throw(new ConfigurationException("Type not specified.", element));

                if(element.SelectSingleNode("properties") == null)
                    properties = new NameValueCollection();
                else
                    properties = (NameValueCollection) nameValueSectionHandler.Create(null, context, element.SelectSingleNode("properties"));

                directory = new DirectoryConfiguration(element.GetAttribute("name"), element.GetAttribute("type"), properties);

                directories.Add(directory.Name, directory);
            }

            return(directories);
        }
All Usage Examples Of System.Configuration.NameValueSectionHandler::Create
NameValueSectionHandler