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

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

public Create ( Object parent, Object context, XmlNode section ) : object
parent Object
context Object
section System.Xml.XmlNode
Результат object
        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;
        }
    }

Usage Example

 public object Create(object parent, object configContext, XmlNode section)
 {
     ArrayList list = new ArrayList();
     foreach (XmlNode node in section.ChildNodes)
     {
         if (((node.NodeType != XmlNodeType.Whitespace) && (node.NodeType != XmlNodeType.Comment)) && ((node.NodeType == XmlNodeType.Element) && node.Name.Equals("dataObjectMapping")))
         {
             SingleTagSectionHandler handler = new SingleTagSectionHandler();
             Hashtable hashtable = (Hashtable) handler.Create(null, null, node);
             if (hashtable != null)
             {
                 string fromDataFormat = (string) hashtable["fromDataFormat"];
                 if ((fromDataFormat != null) && (fromDataFormat.Length != 0))
                 {
                     string toDataFormat = (string) hashtable["toDataFormat"];
                     if ((toDataFormat != null) && (toDataFormat.Length != 0))
                     {
                         string typeName = (string) hashtable["type"];
                         if ((typeName != null) && (typeName.Length != 0))
                         {
                             list.Add(new DataObjectMappingInfo(fromDataFormat, toDataFormat, typeName));
                         }
                     }
                 }
             }
         }
     }
     return list;
 }
All Usage Examples Of System.Configuration.SingleTagSectionHandler::Create
SingleTagSectionHandler