コード例 #1
0
 /// <summary>
 /// Find a child with a given name in an element.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XmlElement FindChild(this XmlElement element, string name)
 {
     foreach (var child in element.ChildElements())
         if (child.Name == name)
             return child;
     return null;
 }
コード例 #2
0
 /// <summary>
 /// Find a terminal child with a given name in an element.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XmlElement FindTerminalChild(this XmlElement element, string name)
 {
     foreach (var child in element.ChildElements())
     {
         if (child.Name == name && child.IsTerminal())
             return child;
     }
     return null;
 }